Revert "Merge pull request #1455 from chaosma/master"

This reverts commit 5d6e619a07, reversing
changes made to df37360c3a.
pull/1464/head
Eugene Kim 5 years ago
parent cb0299ba6f
commit 88e4eec625
  1. 2
      consensus/consensus_v2.go
  2. 4
      core/blockchain.go
  3. 2
      node/node_cross_shard.go
  4. 5
      node/node_newblock.go

@ -960,7 +960,7 @@ func (consensus *Consensus) tryCatchup() {
if consensus.BlockVerifier == nil {
// do nothing
} else if err := consensus.BlockVerifier(block); err != nil {
consensus.getLogger().Info().Err(err).Msg("[TryCatchup]block verification faied")
consensus.getLogger().Info().Msg("[TryCatchup]block verification faied")
return
}

@ -1150,9 +1150,7 @@ func (bc *BlockChain) InsertChain(chain types.Blocks) (int, error) {
return n, errors.New("proposed cross links are not sorted")
}
for _, crossLink := range *crossLinks {
if err := bc.WriteCrossLinks(types.CrossLinks{crossLink}, false); err == nil {
utils.Logger().Info().Uint64("blockNum", crossLink.BlockNum().Uint64()).Uint32("shardID", crossLink.ShardID()).Msg("[InsertChain] Cross Link Added to Beaconchain")
}
bc.WriteCrossLinks(types.CrossLinks{crossLink}, false)
bc.DeleteCrossLinks(types.CrossLinks{crossLink}, true)
bc.WriteShardLastCrossLink(crossLink.ShardID(), crossLink)
}

@ -282,6 +282,6 @@ func (node *Node) ProcessReceiptMessage(msgPayload []byte) {
// TODO: remove in future if not useful
node.Blockchain().WriteCXReceipts(cxp.MerkleProof.ShardID, cxp.MerkleProof.BlockNum.Uint64(), cxp.MerkleProof.BlockHash, cxp.Receipts, true)
utils.Logger().Debug().Interface("cxp", cxp).Msg("[ProcessReceiptMessage] Add CXReceiptsProof to pending Receipts")
utils.Logger().Debug().Msg("[ProcessReceiptMessage] Add CXReceiptsProof to pending Receipts")
node.AddPendingReceipts(&cxp)
}

@ -222,7 +222,6 @@ func (node *Node) proposeReceiptsProof() []*types.CXReceiptsProof {
for _, cxp := range node.pendingCXReceipts {
// check double spent
if node.Blockchain().IsSpent(cxp) {
utils.Logger().Debug().Interface("cxp", cxp).Msg("[proposeReceiptsProof] CXReceipt is spent")
continue
}
hash := cxp.MerkleProof.BlockHash
@ -234,17 +233,15 @@ func (node *Node) proposeReceiptsProof() []*types.CXReceiptsProof {
}
if err := node.compareCrosslinkWithReceipts(cxp); err != nil {
utils.Logger().Debug().Err(err).Interface("cxp", cxp).Msg("[proposeReceiptsProof] CrossLink Verify Fail")
if err != ErrCrosslinkVerificationFail {
pendingReceiptsList = append(pendingReceiptsList, cxp)
}
} else {
utils.Logger().Debug().Interface("cxp", cxp).Msg("[proposeReceiptsProof] CXReceipts Added")
validReceiptsList = append(validReceiptsList, cxp)
}
}
node.pendingCXReceipts = pendingReceiptsList
node.pendingCXMutex.Unlock()
utils.Logger().Debug().Msgf("[proposeReceiptsProof] number of validReceipts %d, pendingReceipts %d", len(validReceiptsList), len(pendingReceiptsList))
utils.Logger().Debug().Msgf("[proposeReceiptsProof] number of validReceipts %d", len(validReceiptsList))
return validReceiptsList
}

Loading…
Cancel
Save