diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-10-20 17:26:32 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-03-12 12:19:09 +0800 |
commit | 1901a79cc82a0829c62d446d1cc3e16005240b7a (patch) | |
tree | e4327424a5d5d8b57e835b3331b943c4d5c9124a /dex | |
parent | 174b8c3bc1202de027b62fb1d995df3c69bdb254 (diff) | |
download | dexon-1901a79cc82a0829c62d446d1cc3e16005240b7a.tar dexon-1901a79cc82a0829c62d446d1cc3e16005240b7a.tar.gz dexon-1901a79cc82a0829c62d446d1cc3e16005240b7a.tar.bz2 dexon-1901a79cc82a0829c62d446d1cc3e16005240b7a.tar.lz dexon-1901a79cc82a0829c62d446d1cc3e16005240b7a.tar.xz dexon-1901a79cc82a0829c62d446d1cc3e16005240b7a.tar.zst dexon-1901a79cc82a0829c62d446d1cc3e16005240b7a.zip |
core: included Dexcon metadata in block
Diffstat (limited to 'dex')
-rw-r--r-- | dex/app.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/dex/app.go b/dex/app.go index 40366c25f..ecd29546e 100644 --- a/dex/app.go +++ b/dex/app.go @@ -347,22 +347,27 @@ func (d *DexconApp) BlockDelivered(blockHash coreCommon.Hash, result coreTypes.F block := d.blockchain.GetConfirmedBlockByHash(blockHash) if block == nil { - log.Error("Can not get confirmed block") - return + panic("Can not get confirmed block") } var transactions types.Transactions err := rlp.Decode(bytes.NewReader(block.Payload), &transactions) if err != nil { log.Error("Payload rlp decode failed", "error", err) - return + panic(err) } var witnessData witnessData err = rlp.Decode(bytes.NewReader(block.Witness.Data), &witnessData) if err != nil { log.Error("Witness rlp decode failed", "error", err) - return + panic(err) + } + + block.Payload = nil + dexconMeta, err := rlp.EncodeToBytes(block) + if err != nil { + panic(err) } log.Debug("Block proposer id", "hash", block.ProposerID) @@ -378,13 +383,14 @@ func (d *DexconApp) BlockDelivered(blockHash coreCommon.Hash, result coreTypes.F ChainBlockHeight: block.Position.Height, // TODO(bojie): fix it GasLimit: 8000000, + DexconMeta: dexconMeta, Difficulty: big.NewInt(1), }, transactions, nil, nil) _, err = d.blockchain.InsertPendingBlocks([]*types.Block{newBlock}) if err != nil { log.Error("Insert chain", "error", err) - return + panic(err) } log.Debug("Insert pending block success", "height", result.Height) |