[Bug]: Disallow coinbase transactions as donations or deposits #1196
Labels
bug
Something isn't working
deposit
The deposit sBTC operation.
design
making a design decision.
sbtc signer binary
The sBTC Bootstrap Signer.
Milestone
Bug - Disallow coinbase transactions as donations or deposits
1. Description
Right now, we allow any bitcoin transaction to serve as a donation or a deposit. Unfortunately, coinbase transactions screw everything up. We cannot spend them immediately, and the
getrawtransaction
RPC on bitcoin core does not give us all of the expected fields when the verbosity level is set to 2. So we should just disallow them as deposits and donations.1.1 Context & Purpose
If a coinbase transaction is spent to the signers, we will encounter an error while processing the block. This could be problematic if there are sweep transactions confirmed within the block, as it would prevent us from correctly processing all transactions in the block. Although it is highly unlikely for a coinbase transaction to be spent to the signers, such an occurrence could block the signers from sweeping deposits and withdrawals until the issue is resolved.
2. Technical Details:
When processing transactions within a bitcoin block or a deposit request, check to see if each potential donation and deposit transaction is a coinbase transaction. For the deposit code path, check around here:
sbtc/signer/src/block_observer.rs
Lines 78 to 88 in 3853ad1
log it and return an error if it's a coinbase transaction.
For the donations code path log it and continue around here:
sbtc/signer/src/block_observer.rs
Lines 454 to 455 in 3853ad1
These changes should effectively prevent signing deposits from coinbase transactions since we will never have a record of the deposit request in our database.
2.1 Acceptance Criteria:
3. Related Issues and Pull Requests (optional):
Doing this with #1194 will help shore up processing of a bitcoin block.
The text was updated successfully, but these errors were encountered: