Browse Source

Cope gracefully with lack of default_witness_commitment despite rules supporting segwit.

master
Con Kolivas 7 years ago
parent
commit
5e93cf8219
  1. 7
      src/stratifier.c

7
src/stratifier.c

@ -1449,8 +1449,11 @@ retry:
witnessdata_check = json_string_value(json_object_get(wb->json, "default_witness_commitment")); witnessdata_check = json_string_value(json_object_get(wb->json, "default_witness_commitment"));
gbt_witness_data(wb, txn_array); gbt_witness_data(wb, txn_array);
// Verify against the pre-calculated value if it exists. Skip the size/OP_RETURN bytes. // Verify against the pre-calculated value if it exists. Skip the size/OP_RETURN bytes.
if (wb->insert_witness && witnessdata_check[0] && safecmp(witnessdata_check + 4, wb->witnessdata) != 0) if (likely(witnessdata_check)) {
LOGERR("Witness from btcd: %s. Calculated Witness: %s", witnessdata_check + 4, wb->witnessdata); if (wb->insert_witness && witnessdata_check[0] && safecmp(witnessdata_check + 4, wb->witnessdata) != 0)
LOGERR("Witness from btcd: %s. Calculated Witness: %s", witnessdata_check + 4, wb->witnessdata);
} else
LOGNOTICE("Segwit rules returned but no default_witness_commitment to check witness data");
break; break;
} }
} }

Loading…
Cancel
Save