chaindb: more cases for genesis block.
This commit is contained in:
parent
e65f6e26c3
commit
0ffabd7a9a
@ -1329,7 +1329,8 @@ ChainDB.prototype._save = async function save(entry, block, view) {
|
||||
}
|
||||
|
||||
// Hash->next-block index.
|
||||
this.put(layout.n(entry.prevBlock), hash);
|
||||
if (!entry.isGenesis())
|
||||
this.put(layout.n(entry.prevBlock), hash);
|
||||
|
||||
// Height->hash index.
|
||||
this.put(layout.H(entry.height), hash);
|
||||
@ -1375,6 +1376,8 @@ ChainDB.prototype.reconnect = async function reconnect(entry, block, view) {
|
||||
ChainDB.prototype._reconnect = async function reconnect(entry, block, view) {
|
||||
let hash = block.hash();
|
||||
|
||||
assert(!entry.isGenesis());
|
||||
|
||||
// We can now add a hash->next-block index.
|
||||
this.put(layout.n(entry.prevBlock), hash);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user