mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
wallet: Add primitive to roll back to a specific height
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
504202973f
commit
9440b23852
@ -1689,3 +1689,11 @@ void wallet_block_remove(struct wallet *w, struct block *b)
|
||||
assert(sqlite3_step(stmt) == SQLITE_DONE);
|
||||
sqlite3_finalize(stmt);
|
||||
}
|
||||
|
||||
void wallet_blocks_rollback(struct wallet *w, u32 height)
|
||||
{
|
||||
sqlite3_stmt *stmt = db_prepare(w->db, "DELETE FROM blocks "
|
||||
"WHERE height >= ?");
|
||||
sqlite3_bind_int(stmt, 1, height);
|
||||
db_exec_prepared(w->db, stmt);
|
||||
}
|
||||
|
@ -695,5 +695,9 @@ void wallet_block_add(struct wallet *w, struct block *b);
|
||||
*/
|
||||
void wallet_block_remove(struct wallet *w, struct block *b);
|
||||
|
||||
/**
|
||||
* wallet_blocks_rollback - Roll the blockchain back to the given height
|
||||
*/
|
||||
void wallet_blocks_rollback(struct wallet *w, u32 height);
|
||||
|
||||
#endif /* WALLET_WALLET_H */
|
||||
|
Loading…
Reference in New Issue
Block a user