fix pushing to txmempool

This commit is contained in:
2026-05-29 12:49:51 +02:00
parent 91d7bfa4e7
commit 41a154a9fd
2 changed files with 4 additions and 2 deletions

View File

@@ -858,7 +858,7 @@ int main(int argc, char* argv[]) {
*/
// Insert into txmempool
if (!TxMempool_Insert(spendTx)) {
if (TxMempool_Insert(spendTx) < 0) {
printf("failed to add transaction to mempool, transaction rejected\n");
continue;
}

View File

@@ -239,6 +239,7 @@ net_node_t* Node_Create() {
pthread_mutex_init(&node->seenLock, NULL);
pthread_mutex_init(&node->outboundLock, NULL);
node->seenBlocks = DynSet_Create(32); // 32-byte canonical hashes
TxMempool_Init();
TcpServer_Init(node->server, listenPort, "0.0.0.0");
@@ -284,6 +285,7 @@ void Node_Destroy(net_node_t* node) {
}
OrphanPool_Destroy();
TxMempool_Destroy();
if (node->seenBlocks) {
DynSet_Destroy(node->seenBlocks);
@@ -639,7 +641,7 @@ void Node_Server_OnData(tcp_connection_t* client) {
// Push to mempool if it's not already present
if (!TxMempool_Lookup(txHash, &tx)) {
if (TxMempool_Insert(tx) > 0) {
if (TxMempool_Insert(tx) >= 0) {
printf("Added transaction %s from node %u to mempool\n", txHashHex, client ? client->connectionId : 0U);
// Broadcast to other peers
net_node_t* node = Node_FromConnection(client);