Fail if tx blob is empty

Some node on the network apparently has a corrupted DB and is spewing
empty tx blobs onto the network.  Detect such a case rather than
broadcasting broken empty txes.
This commit is contained in:
Jason Rhinelander 2022-06-01 15:44:24 -03:00
parent e120075c37
commit a6157fe0a9
No known key found for this signature in database
GPG Key ID: C4992CE7A88D4262
1 changed files with 3 additions and 0 deletions

View File

@ -1998,6 +1998,9 @@ bool BlockchainLMDB::get_txpool_tx_blob(const crypto::hash& txid, std::string &b
if (result != 0)
throw1(DB_ERROR(lmdb_error("Error finding txpool tx blob: ", result).c_str()));
if (v.mv_size == 0)
throw1(DB_ERROR("Error finding txpool tx blob: tx is present, but data is empty"));
bd.assign(reinterpret_cast<const char*>(v.mv_data), v.mv_size);
return true;
}