-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create ReservedUtxoService #2
Conversation
ICoin[] spentCoins = context.TransactionBuilder.FindSpentCoins(transaction); | ||
|
||
// Here we reserve the UTXO OutPoint so that it cant be selected again. | ||
if (spentCoins.Any()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zeptin not sure if this should be done here. Perhaps closer to where SC transaction is created?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is fine for now, although it is a few layers down from the controller itself.
I suppose the principle of least surprise here is that creating multiple transactions in succession should 'just work' - if it relies on the reservation under the hood then that is acceptable.
{ | ||
foreach (var outPoint in outPoints) | ||
{ | ||
if (!this.reservedCoins.Contains(outPoint)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically you only need to do this check to make the log entry accurate, adding regardless is harmless
src/Stratis.Bitcoin.Features.SmartContracts/Wallet/SmartContractTransactionService.cs
Outdated
Show resolved
Hide resolved
…ctTransactionService.cs Co-authored-by: zeptin <[email protected]>
…tisFullNode into fix-inputs-with-sc
Proposal to fix stratisproject/StratisBitcoinFullNode#4187