diff --git a/contracts/utils.go b/contracts/utils.go index 7dbf205a53..d664471501 100644 --- a/contracts/utils.go +++ b/contracts/utils.go @@ -355,7 +355,7 @@ func GetSignersSignedAtBlockHash(c *posv.Posv, chain consensus.ChainReader, data // Get signers list from bytes. func GetSignersFromBytes(byteHeader []byte) []common.Address { signers := make([]common.Address, len(byteHeader)/common.AddressLength) - for i := 0; i < len(masternodes); i++ { + for i := 0; i < len(signers); i++ { copy(signers[i][:], byteHeader[i*common.AddressLength:]) } diff --git a/core/state_transition.go b/core/state_transition.go index 1a5f6c0fd0..2fb9893d00 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -238,7 +238,7 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo contractAction = "contract creation" } else { // Increment the nonce for the next transaction - nonce = st.state.GetNonce(sender.Address())+1 + nonce = st.state.GetNonce(sender.Address()) + 1 st.state.SetNonce(sender.Address(), nonce) ret, st.gas, vmerr = evm.Call(sender, st.to().Address(), st.data, st.gas, st.value) contractAction = "contract call" diff --git a/eth/backend.go b/eth/backend.go index 9a2f121394..514186692d 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -337,9 +337,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { } } if len(prevSigners) > 0 { - for _, signer := range prevSigners { - penSigners = append(penSigners, signer) - } + penSigners = append(penSigners, prevSigners...) } } diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index cda2f037ac..59f59972e5 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -683,7 +683,7 @@ func (s *PublicBlockChainAPI) GetMasternodes(b *types.Block, ctx context.Context if prevCheckpointBlock != nil { masternodes = engine.GetMasternodesFromCheckpointHeader(prevCheckpointBlock.Header(), curBlockNumber, s.b.ChainConfig().Posv.Epoch) } - } else { + } else { log.Error("Undefined POSV consensus engine") } } @@ -980,7 +980,7 @@ func (s *PublicBlockChainAPI) rpcOutputBlockSigners(b *types.Block, ctx context. } } } - } else { + } else { log.Error("Undefined POSV consensus engine") } }