aboutsummaryrefslogtreecommitdiffstats
path: root/internal/ethapi/backend.go
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2017-05-25 23:08:13 +0800
committerFelix Lange <fjl@twurst.com>2017-05-30 22:43:38 +0800
commitea11f7dd7aa77856a04d83d0db8f303d02e0ce14 (patch)
tree5ef4de2afde2e5c0ddfde52775e1001ff7f32c08 /internal/ethapi/backend.go
parent07aae19e5da66ed404453e6be70ab84db516207b (diff)
downloadgo-tangerine-ea11f7dd7aa77856a04d83d0db8f303d02e0ce14.tar
go-tangerine-ea11f7dd7aa77856a04d83d0db8f303d02e0ce14.tar.gz
go-tangerine-ea11f7dd7aa77856a04d83d0db8f303d02e0ce14.tar.bz2
go-tangerine-ea11f7dd7aa77856a04d83d0db8f303d02e0ce14.tar.lz
go-tangerine-ea11f7dd7aa77856a04d83d0db8f303d02e0ce14.tar.xz
go-tangerine-ea11f7dd7aa77856a04d83d0db8f303d02e0ce14.tar.zst
go-tangerine-ea11f7dd7aa77856a04d83d0db8f303d02e0ce14.zip
internal/ethapi: add mutex around signing + nonce assignment
This prevents concurrent assignment of identical nonces when automatic assignment is used.
Diffstat (limited to 'internal/ethapi/backend.go')
-rw-r--r--internal/ethapi/backend.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go
index 42bf26613..68b5069d0 100644
--- a/internal/ethapi/backend.go
+++ b/internal/ethapi/backend.go
@@ -73,6 +73,7 @@ type State interface {
}
func GetAPIs(apiBackend Backend) []rpc.API {
+ nonceLock := new(AddrLocker)
return []rpc.API{
{
Namespace: "eth",
@@ -87,7 +88,7 @@ func GetAPIs(apiBackend Backend) []rpc.API {
}, {
Namespace: "eth",
Version: "1.0",
- Service: NewPublicTransactionPoolAPI(apiBackend),
+ Service: NewPublicTransactionPoolAPI(apiBackend, nonceLock),
Public: true,
}, {
Namespace: "txpool",
@@ -111,7 +112,7 @@ func GetAPIs(apiBackend Backend) []rpc.API {
}, {
Namespace: "personal",
Version: "1.0",
- Service: NewPrivateAccountAPI(apiBackend),
+ Service: NewPrivateAccountAPI(apiBackend, nonceLock),
Public: false,
},
}