-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* do not stop parsing a btc block if encountering a parse error, we may have a parse error partially down the block but we shouldn't halt parsing the rest of the txs for that * sql update; delete invalid pop basis upon re-org
- Loading branch information
1 parent
5d1bf8f
commit 6c3d601
Showing
4 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ import ( | |
) | ||
|
||
const ( | ||
bfgdVersion = 15 | ||
bfgdVersion = 16 | ||
|
||
logLevel = "INFO" | ||
verbose = false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
-- Copyright (c) 2025 Hemi Labs, Inc. | ||
-- Use of this source code is governed by the MIT License, | ||
-- which can be found in the LICENSE file. | ||
|
||
BEGIN; | ||
|
||
UPDATE version SET version = 16; | ||
|
||
ALTER TABLE pop_basis DROP CONSTRAINT pop_basis_btc_block_hash_fkey; | ||
|
||
-- upon a re-org, set all references to deleted btc block to NULL, then delete those rows via a trigger | ||
|
||
ALTER TABLE pop_basis ADD CONSTRAINT pop_basis_btc_block_hash_fkey FOREIGN KEY (btc_block_hash) REFERENCES btc_blocks (hash) ON UPDATE SET NULL; | ||
|
||
CREATE FUNCTION clean_pop_basis() RETURNS TRIGGER AS $clean_pop_basis$ | ||
BEGIN | ||
DELETE FROM pop_basis WHERE btc_block_hash IS NULL; | ||
RETURN NULL; | ||
END; | ||
$clean_pop_basis$ LANGUAGE plpgsql; | ||
|
||
CREATE TRIGGER btc_blocks_clean AFTER INSERT OR UPDATE OR DELETE | ||
ON btc_blocks EXECUTE FUNCTION clean_pop_basis(); | ||
|
||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters