blockchain: use blockstore for undo coins
This commit is contained in:
parent
89d3253f29
commit
8b6ec89a64
@ -770,7 +770,7 @@ class ChainDB {
|
|||||||
if (!hash)
|
if (!hash)
|
||||||
throw new Error(`Cannot find hash for ${i}.`);
|
throw new Error(`Cannot find hash for ${i}.`);
|
||||||
|
|
||||||
b.del(layout.u.encode(hash));
|
await this.blocks.pruneUndo(hash);
|
||||||
await this.blocks.prune(hash);
|
await this.blocks.prune(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1016,7 +1016,7 @@ class ChainDB {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
async getUndoCoins(hash) {
|
async getUndoCoins(hash) {
|
||||||
const data = await this.db.get(layout.u.encode(hash));
|
const data = await this.blocks.readUndo(hash);
|
||||||
|
|
||||||
if (!data)
|
if (!data)
|
||||||
return new UndoCoins();
|
return new UndoCoins();
|
||||||
@ -1764,7 +1764,7 @@ class ChainDB {
|
|||||||
|
|
||||||
// Write undo coins (if there are any).
|
// Write undo coins (if there are any).
|
||||||
if (!view.undo.isEmpty())
|
if (!view.undo.isEmpty())
|
||||||
this.put(layout.u.encode(hash), view.undo.commit());
|
await this.blocks.writeUndo(hash, view.undo.commit());
|
||||||
|
|
||||||
// Prune height-288 if pruning is enabled.
|
// Prune height-288 if pruning is enabled.
|
||||||
return this.pruneBlock(entry);
|
return this.pruneBlock(entry);
|
||||||
@ -1823,7 +1823,7 @@ class ChainDB {
|
|||||||
this.saveView(view);
|
this.saveView(view);
|
||||||
|
|
||||||
// Remove undo coins.
|
// Remove undo coins.
|
||||||
this.del(layout.u.encode(hash));
|
await this.blocks.pruneUndo(hash);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
@ -1853,7 +1853,7 @@ class ChainDB {
|
|||||||
if (!hash)
|
if (!hash)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.del(layout.u.encode(hash));
|
await this.blocks.pruneUndo(hash);
|
||||||
await this.blocks.prune(hash);
|
await this.blocks.prune(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,10 +19,10 @@ const bdb = require('bdb');
|
|||||||
* H[height] -> hash
|
* H[height] -> hash
|
||||||
* n[hash] -> next hash
|
* n[hash] -> next hash
|
||||||
* p[hash] -> tip index
|
* p[hash] -> tip index
|
||||||
* b[hash] -> block
|
* b[hash] -> block (deprecated)
|
||||||
* t[hash] -> extended tx
|
* t[hash] -> extended tx
|
||||||
* c[hash] -> coins
|
* c[hash] -> coins
|
||||||
* u[hash] -> undo coins
|
* u[hash] -> undo coins (deprecated)
|
||||||
* v[bit][hash] -> versionbits state
|
* v[bit][hash] -> versionbits state
|
||||||
* T[addr-hash][hash] -> dummy (tx by address)
|
* T[addr-hash][hash] -> dummy (tx by address)
|
||||||
* C[addr-hash][hash][index] -> dummy (coin by address)
|
* C[addr-hash][hash][index] -> dummy (coin by address)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user