Fixed minor bug for get signers from penalties header.

This commit is contained in:
DinhLN 2019-02-22 10:27:22 +07:00 committed by Nguyen Ba Tam
parent 8747342373
commit cafef44074
4 changed files with 5 additions and 7 deletions

View file

@ -355,7 +355,7 @@ func GetSignersSignedAtBlockHash(c *posv.Posv, chain consensus.ChainReader, data
// Get signers list from bytes. // Get signers list from bytes.
func GetSignersFromBytes(byteHeader []byte) []common.Address { func GetSignersFromBytes(byteHeader []byte) []common.Address {
signers := make([]common.Address, len(byteHeader)/common.AddressLength) 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:]) copy(signers[i][:], byteHeader[i*common.AddressLength:])
} }

View file

@ -238,7 +238,7 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo
contractAction = "contract creation" contractAction = "contract creation"
} else { } else {
// Increment the nonce for the next transaction // 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) st.state.SetNonce(sender.Address(), nonce)
ret, st.gas, vmerr = evm.Call(sender, st.to().Address(), st.data, st.gas, st.value) ret, st.gas, vmerr = evm.Call(sender, st.to().Address(), st.data, st.gas, st.value)
contractAction = "contract call" contractAction = "contract call"

View file

@ -337,9 +337,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
} }
} }
if len(prevSigners) > 0 { if len(prevSigners) > 0 {
for _, signer := range prevSigners { penSigners = append(penSigners, prevSigners...)
penSigners = append(penSigners, signer)
}
} }
} }

View file

@ -683,7 +683,7 @@ func (s *PublicBlockChainAPI) GetMasternodes(b *types.Block, ctx context.Context
if prevCheckpointBlock != nil { if prevCheckpointBlock != nil {
masternodes = engine.GetMasternodesFromCheckpointHeader(prevCheckpointBlock.Header(), curBlockNumber, s.b.ChainConfig().Posv.Epoch) masternodes = engine.GetMasternodesFromCheckpointHeader(prevCheckpointBlock.Header(), curBlockNumber, s.b.ChainConfig().Posv.Epoch)
} }
} else { } else {
log.Error("Undefined POSV consensus engine") 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") log.Error("Undefined POSV consensus engine")
} }
} }