Skip to content

Commit 05bb095

Browse files
committed
chain: Always serialize blocks as EthereumBlock
1 parent 833f8c4 commit 05bb095

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

chain/ethereum/src/chain.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,12 +432,20 @@ impl Block for BlockFinality {
432432
// code reading from the chain store always expects the JSON data to
433433
// have the form of an `EthereumBlock`.
434434
//
435-
// The serialization here will subtly use different formats because
436-
// it serializes objects of different types.
435+
// Even though this bug is fixed now and we always use the
436+
// serialization of an `EthereumBlock`, there are still chain stores
437+
// in existence that used the old serialization form, and we need to
438+
// deal with that when deserializing
437439
//
438440
// see also 7736e440-4c6b-11ec-8c4d-b42e99f52061
439441
match self {
440-
BlockFinality::Final(block) => json::to_value(block),
442+
BlockFinality::Final(block) => {
443+
let eth_block = EthereumBlock {
444+
block: block.clone(),
445+
transaction_receipts: vec![],
446+
};
447+
json::to_value(eth_block)
448+
}
441449
BlockFinality::NonFinal(block) => json::to_value(&block.ethereum_block),
442450
}
443451
}

0 commit comments

Comments
 (0)