Skip to content

Commit

Permalink
Merge pull request #190 from kcalvinalvin/2024-06-24-dont-include-0s
Browse files Browse the repository at this point in the history
indexers: only include positions that were found
  • Loading branch information
kcalvinalvin committed Jun 27, 2024
2 parents 496c40a + e3fa68a commit e166f10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions blockchain/indexers/flatutreexoproofindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -872,8 +872,10 @@ func (idx *FlatUtreexoProofIndex) GenerateUDataPartial(dels []wire.LeafData, pos

targets := make([]uint64, len(delHashes))
for i, delHash := range delHashes {
pos, _ := idx.utreexoState.state.GetLeafPosition(delHash)
targets[i] = pos
pos, found := idx.utreexoState.state.GetLeafPosition(delHash)
if found {
targets[i] = pos
}
}

ud.AccProof = utreexo.Proof{
Expand Down
6 changes: 4 additions & 2 deletions blockchain/indexers/utreexoproofindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,10 @@ func (idx *UtreexoProofIndex) GenerateUDataPartial(dels []wire.LeafData, positio

targets := make([]uint64, len(delHashes))
for i, delHash := range delHashes {
pos, _ := idx.utreexoState.state.GetLeafPosition(delHash)
targets[i] = pos
pos, found := idx.utreexoState.state.GetLeafPosition(delHash)
if found {
targets[i] = pos
}
}
ud.AccProof = utreexo.Proof{
Targets: targets,
Expand Down

1 comment on commit e166f10

@HalFinneyIsMyHomeBoy
Copy link

@HalFinneyIsMyHomeBoy HalFinneyIsMyHomeBoy commented on e166f10 Jul 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDIT: Never mind this comment below, it didn't fix it. I ran the new code in the wrong VM.
Currently running 2 clones of this VM. One with the latest fix and one without, we will see which crashes.

@kcalvinalvin This change seems to have fixed the orphan error loop.
I saved a snapshot of the VM that was stuck in this loop, and ran it with the latest commits.
It's syncing now. Good work!

owner@owner:~/utreexod$ ./utreexod --flatutreexoproofindex --prune=0
2024-07-01 16:07:13.031 [INF] BTCD: Version 0.3.1-beta
2024-07-01 16:07:13.032 [INF] BTCD: Loading block database from '/home/owner/.utreexod/data/mainnet/blocks_ffldb'
2024-07-01 16:07:13.082 [INF] BTCD: Block database loaded
2024-07-01 16:07:13.089 [INF] INDX: Flat Utreexo Proof index is enabled
2024-07-01 16:07:13.093 [INF] INDX: Initializing Utreexo state from '/home/owner/.utreexod/data/mainnet/utreexostate_flat'
2024-07-01 16:07:14.065 [INF] INDX: Utreexo state loaded
2024-07-01 16:07:16.207 [INF] CHAN: Pre-alloacting for 251 MiB:
2024-07-01 16:07:16.212 [INF] CHAN: Loading block index...
2024-07-01 16:07:19.464 [INF] CHAN: Chain state (height 238924, hash 0000000000000101de4d20af8a3407203efeb9839c20d868c15c95141830a2e4, totaltx 18740618, work 1342728262854513264436)
2024-07-01 16:07:20.537 [INF] BDKW: Started the BDK wallet manager.
2024-07-01 16:07:20.552 [INF] RPCS: RPCUser or RPCPassword not set. Making cookiefile at /home/owner/.utreexod/data/mainnet/.cookie
2024-07-01 16:07:20.552 [INF] RPCS: RPC server listening on 127.0.0.1:8334
2024-07-01 16:07:20.564 [INF] AMGR: Loaded 1042 addresses from file '/home/owner/.utreexod/data/mainnet/peers.json'
2024-07-01 16:07:20.566 [INF] SYNC: New valid peer 192.168.1.30:8333 (outbound) (/Satoshi:26.0.0/)
2024-07-01 16:07:20.566 [INF] SYNC: Syncing to block height 850254 from peer 192.168.1.30:8333
2024-07-01 16:07:20.566 [INF] SYNC: Downloading headers for blocks 238925 to 250000 from peer 192.168.1.30:8333
2024-07-01 16:07:20.733 [INF] SYNC: Verified downloaded block header against checkpoint at height 250000/hash 000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214
2024-07-01 16:07:20.734 [INF] SYNC: Received 11076 block headers: Fetching blocks
2024-07-01 16:07:31.325 [INF] SYNC: Processed 4 blocks in the last 10.59s (1475 transactions, height 238928, 2013-05-31 20:29:37 +0000 UTC, ~98 MiB cache)
2024-07-01 16:07:41.734 [INF] SYNC: Processed 19 blocks in the last 10.4s (5651 transactions, height 238947, 2013-05-31 23:17:49 +0000 UTC, ~99 MiB cache)
2024-07-01 16:07:51.893 [INF] SYNC: Processed 52 blocks in the last 10.15s (13944 transactions, height 238999, 2013-06-01 05:23:03 +0000 UTC, ~100 MiB cache)
2024-07-01 16:08:02.960 [INF] SYNC: Processed 56 blocks in the last 11.06s (14066 transactions, height 239055, 2013-06-01 12:08:02 +0000 UTC, ~101 MiB cache)
2024-07-01 16:08:13.088 [INF] SYNC: Processed 65 blocks in the last 10.12s (16678 transactions, height 239120, 2013-06-01 19:17:30 +0000 UTC, ~103 MiB cache)

Please sign in to comment.