aboutsummaryrefslogtreecommitdiffstats
path: root/xeth/xeth.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-08-15 06:33:52 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-08-15 06:33:52 +0800
commit7bb5ac045e5e2f06bbae085114aeffc80af58de4 (patch)
tree066b9c9507740fd4ff3b0b3adf7db9ccc3436494 /xeth/xeth.go
parentcd81356acef707e077622791a88864a221fa13be (diff)
downloadgo-tangerine-7bb5ac045e5e2f06bbae085114aeffc80af58de4.tar
go-tangerine-7bb5ac045e5e2f06bbae085114aeffc80af58de4.tar.gz
go-tangerine-7bb5ac045e5e2f06bbae085114aeffc80af58de4.tar.bz2
go-tangerine-7bb5ac045e5e2f06bbae085114aeffc80af58de4.tar.lz
go-tangerine-7bb5ac045e5e2f06bbae085114aeffc80af58de4.tar.xz
go-tangerine-7bb5ac045e5e2f06bbae085114aeffc80af58de4.tar.zst
go-tangerine-7bb5ac045e5e2f06bbae085114aeffc80af58de4.zip
xeth: added a transact mu
Added a transact mutex. The transact mutex will fix an issue where transactions were created with the same nonce resulting in some transactions being dropped. This happened when two concurrent calls would call the `Transact` method (which is OK) which would both call `GetNonce`. While the managed is thread safe it does not help us in this case.
Diffstat (limited to 'xeth/xeth.go')
-rw-r--r--xeth/xeth.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go
index 5a57608bc..0ad0e507a 100644
--- a/xeth/xeth.go
+++ b/xeth/xeth.go
@@ -89,8 +89,7 @@ type XEth struct {
messagesMu sync.RWMutex
messages map[int]*whisperFilter
- // regmut sync.Mutex
- // register map[string][]*interface{} // TODO improve return type
+ transactMu sync.Mutex
agent *miner.RemoteAgent
@@ -952,8 +951,9 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS
}
*/
- // TODO: align default values to have the same type, e.g. not depend on
- // common.Value conversions later on
+ self.transactMu.Lock()
+ defer self.transactMu.Unlock()
+
var nonce uint64
if len(nonceStr) != 0 {
nonce = common.Big(nonceStr).Uint64()