storeMerkleProof abstract method
Store merkle proof for a transaction.
Proofs are never deleted (audit bead libspiffy-mny). A transaction has
one row per block its proofs name, plus rows without a block hash for
proofs whose header was not known (told apart by their merkleProof).
At most one row per txid is current (MerkleProof.isCurrent: verified
or pendingHeader): the transaction's current proof.
Storing proof:
- updates the row with the same (txid, block hash); else the row with
no block hash and the same
merkleProof(a MerkleProofStatus.pendingHeader proof whose header arrived); else, whenproofhas no block hash, a row with the samemerkleProof(keeping that row's block hash); otherwise it adds a row. A MerkleProofStatus.rejected proof is stored without a block hash and only ever updates a row that has none (bead libspiffy-azl); - when
proofis current, marks every other current row oftxidorphaned (the transaction was mined again in another block):proofbecomes the current proof; - when
proofis orphaned or rejected, leaves the current proof alone.
A row keeps its first createdAt; statusChangedAt moves when its
status changes (MerkleProof.statusChangedAt, default now).
Implementation
Future<void> storeMerkleProof(String txid, MerkleProof proof);