Skip to content

Commit 95b01c1

Browse files
committed
fix: ongoing commit logic + better error messages
* correct the ongoing commit logic (and RBF handling) in bitcoin tx submissions * better error messages from send_http_request
1 parent 6d30ffa commit 95b01c1

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

stackslib/src/net/httpcore.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,15 +1953,16 @@ pub fn send_http_request(
19531953
// Step 5: decode the HTTP message and return it if it's not an error.
19541954
let response_data = match response {
19551955
StacksHttpMessage::Response(response_data) => response_data,
1956-
StacksHttpMessage::Error(path, response) => {
1956+
StacksHttpMessage::Error(_path, response) => {
1957+
let verb = &request.preamble().verb;
1958+
let path = &request.preamble().path_and_query_str;
1959+
let resp_status_code = response.preamble().status_code;
1960+
let resp_body = response.body();
19571961
return Err(io::Error::new(
19581962
io::ErrorKind::Other,
19591963
format!(
1960-
"Request did not succeed ({} != 200). Path: '{}'",
1961-
response.preamble().status_code,
1962-
&path
1963-
)
1964-
.as_str(),
1964+
"HTTP '{verb} {path}' did not succeed ({resp_status_code} != 200). Response body = {resp_body:?}"
1965+
),
19651966
));
19661967
}
19671968
_ => {

testnet/stacks-node/src/burnchains/bitcoin_regtest_controller.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,7 +1662,10 @@ impl BitcoinRegtestController {
16621662
)
16631663
} else {
16641664
// Case 2) ii): Attempt to RBF
1665-
info!("Attempt to replace by fee an outdated leader block commit");
1665+
info!(
1666+
"Attempt to replace by fee an outdated leader block commit";
1667+
"ongoing_txids" => ?ongoing_op.txids
1668+
);
16661669
self.send_block_commit_operation(
16671670
epoch_id,
16681671
payload,
@@ -1674,7 +1677,7 @@ impl BitcoinRegtestController {
16741677
)
16751678
};
16761679

1677-
if res.is_ok() {
1680+
if res.is_err() {
16781681
self.ongoing_block_commit = Some(ongoing_op);
16791682
}
16801683

0 commit comments

Comments
 (0)