Skip to content

Commit

Permalink
boltz: Validate initial claim destination address.
Browse files Browse the repository at this point in the history
  • Loading branch information
s373nZ committed Oct 21, 2024
1 parent d595541 commit 6309432
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Boltz/Detail/ClaimTxHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Ev::Io<void> ClaimTxHandler::core_run() {
}).then([this](Sqlite3::Tx tx) {
/* First do a quick check. */
auto check1 = tx.query(R"QRY(
SELECT lockedUp, timeoutBlockheight
SELECT lockedUp, timeoutBlockheight, destinationAddress
FROM "BoltzServiceFactory_rsub"
WHERE apiAccess = :apiAccess
AND swapId = :swapId
Expand All @@ -65,6 +65,7 @@ Ev::Io<void> ClaimTxHandler::core_run() {
++found;
lockedUp = r.get<bool>(0);
timeoutBlockheight = r.get<std::uint32_t>(1);
destinationAddress = r.get<std::string>(2);
break;
}
if (found == 0) {
Expand All @@ -89,6 +90,17 @@ Ev::Io<void> ClaimTxHandler::core_run() {
return Ev::lift();
});
}
if (destinationAddress.empty()) {
return loge("Swap destination address is empty??"
).then([]() {
throw End();
return Ev::lift();
});
}
// TODO: Check for valid destination address
// if (Bitcoin::addr_to_scriptPubKey(destinationAddress) {
// throw error...
// }

/* Perform the actual fetch of the data. */
auto fetch = tx.query(R"QRY(
Expand Down

0 comments on commit 6309432

Please sign in to comment.