mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
Merge pull request #206 from dinhln89/random
Fixed duplicate nonce value for randomize and sign txs.
This commit is contained in:
commit
0db859674a
1 changed files with 5 additions and 4 deletions
|
|
@ -95,9 +95,7 @@ func CreateTransactionSign(chainConfig *params.ChainConfig, pool *core.TxPool, m
|
|||
// Only process when private key empty in state db.
|
||||
// Save randomize key into state db.
|
||||
randomizeKeyValue := RandStringByte(32)
|
||||
chainDb.Put(randomizeKeyName, randomizeKeyValue)
|
||||
|
||||
tx, err := BuildTxSecretRandomize(nonce, common.HexToAddress(common.RandomizeSMC), chainConfig.Posv.Epoch, randomizeKeyValue)
|
||||
tx, err := BuildTxSecretRandomize(nonce+1, common.HexToAddress(common.RandomizeSMC), chainConfig.Posv.Epoch, randomizeKeyValue)
|
||||
if err != nil {
|
||||
log.Error("Fail to get tx opening for randomize", "error", err)
|
||||
return err
|
||||
|
|
@ -112,6 +110,9 @@ func CreateTransactionSign(chainConfig *params.ChainConfig, pool *core.TxPool, m
|
|||
if err != nil {
|
||||
log.Error("Fail to add tx secret to local pool.", "error", err)
|
||||
}
|
||||
|
||||
// Put randomize key into chainDb.
|
||||
chainDb.Put(randomizeKeyName, randomizeKeyValue)
|
||||
}
|
||||
|
||||
// Set opening for randomize.
|
||||
|
|
@ -121,7 +122,7 @@ func CreateTransactionSign(chainConfig *params.ChainConfig, pool *core.TxPool, m
|
|||
log.Error("Fail to get randomize key from state db.", "error", err)
|
||||
}
|
||||
|
||||
tx, err := BuildTxOpeningRandomize(nonce, common.HexToAddress(common.RandomizeSMC), randomizeKeyValue)
|
||||
tx, err := BuildTxOpeningRandomize(nonce+1, common.HexToAddress(common.RandomizeSMC), randomizeKeyValue)
|
||||
if err != nil {
|
||||
log.Error("Fail to get tx opening for randomize", "error", err)
|
||||
return err
|
||||
|
|
|
|||
Loading…
Reference in a new issue