diff --git a/src/stratifier.c b/src/stratifier.c index d1468a2b..566ea90d 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -1449,8 +1449,11 @@ retry: witnessdata_check = json_string_value(json_object_get(wb->json, "default_witness_commitment")); gbt_witness_data(wb, txn_array); // 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) - LOGERR("Witness from btcd: %s. Calculated Witness: %s", witnessdata_check + 4, wb->witnessdata); + if (likely(witnessdata_check)) { + 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; } }