@@ -114,6 +114,13 @@ bool BIP352Index::GetSilentPaymentKeys(const std::vector<CTransactionRef>& txs,
114
114
return true ;
115
115
}
116
116
117
+ interfaces::Chain::NotifyOptions BIP352Index::CustomOptions ()
118
+ {
119
+ interfaces::Chain::NotifyOptions options;
120
+ options.connect_undo_data = true ;
121
+ return options;
122
+ }
123
+
117
124
bool BIP352Index::CustomAppend (const interfaces::BlockInfo& block)
118
125
{
119
126
// Exclude genesis block transaction because outputs are not spendable. This
@@ -123,26 +130,8 @@ bool BIP352Index::CustomAppend(const interfaces::BlockInfo& block)
123
130
// Exclude pre-taproot
124
131
if (block.height < m_start_height) return true ;
125
132
126
- assert (block.data );
127
-
128
- std::vector<std::pair<uint256, CPubKey>> items;
129
-
130
- const CBlockIndex* block_index = WITH_LOCK (cs_main, return m_chainstate->m_blockman .LookupBlockIndex (block.hash ));
131
- // TODO: fix sloppy rebase, DANGER!
132
- assert (block_index != nullptr );
133
-
134
-
135
- CBlockUndo block_undo;
136
-
137
- if (!(m_chainstate->m_blockman .ReadBlockUndo (block_undo, *block_index))) {
138
- // Should be impossible on an unpruned node
139
- LogError (" Failed to read undo file for %s" , GetName ());
140
- return false ;
141
- };
142
-
143
133
tweak_index_entry index_entry;
144
- GetSilentPaymentKeys (block.data ->vtx , block_undo, index_entry);
145
-
134
+ GetSilentPaymentKeys (Assert (block.data )->vtx , *Assert (block.undo_data ), index_entry);
146
135
return m_db->WriteSilentPayments (make_pair (block.hash , index_entry));
147
136
}
148
137
0 commit comments