MetacoSA / QBitNinja

An Open Source and powerful blockchain API
MIT License
68 stars 42 forks source link

Can't broadcast on TestNet #78

Closed ArtjomP closed 6 years ago

ArtjomP commented 6 years ago

Hello there. I can't broadcast transactions on TestNet. For MainNet it works well. For example this is my transaction (verified) { "hash": "5a6cce94e6c7ad1eb0b7a1172f091700167494d4fb38652546f2746b3d88b322", "ver": 1, "vin_sz": 3, "vout_sz": 2, "lock_time": 0, "size": 519, "in": [ { "prev_out": { "hash": "8e0a0be3653135e30ce8584bce8107ab738344606c19d20477e3c187f27baec9", "n": 1 }, "scriptSig": "3044022044a9c1b6a0fca6765fa4fb3fe3c5af72a643558e3e9bf39f1538becc65816df202202f1f11648988700ad9dc9089f877d86b95509cbd55535b1953725e01c1d1958801 022ff0fb2a8c5861b35388d6514161db26e90bb18b04c05f5cb3a57e722831e758" }, { "prev_out": { "hash": "521ab422f10c47dae31256e6d0c987212044c6c03262e79d93acbd4000519933", "n": 0 }, "scriptSig": "304402201a384cd1b3fa8df8eb95086e89cce9e90dd91e55a6eb7a126d71189725a3433002204f108b605a4b684bcc87c26cd461902a41d4c25cc5507a21f12426f10ae59a9c01 022ff0fb2a8c5861b35388d6514161db26e90bb18b04c05f5cb3a57e722831e758" }, { "prev_out": { "hash": "72a72b623b875ae8d3c3b5e060a89ac89398429d4878a4ff9cb9ac04eb9e14c6", "n": 0 }, "scriptSig": "304402203d5168122ba377024ba7d69418f7dcf488a1745dd14ec184f01e7fe442b9fe7202200f4053c8ca5d84a77a77b4422c0a4e7857e90513ad478e36918122a3c0e7a91001 022ff0fb2a8c5861b35388d6514161db26e90bb18b04c05f5cb3a57e722831e758" } ], "out": [ { "value": "0.01018177", "scriptPubKey": "OP_DUP OP_HASH160 36668c34beb6abebb83dcb6c41a6518be412acab OP_EQUALVERIFY OP_CHECKSIG" }, { "value": "0.00001018", "scriptPubKey": "OP_DUP OP_HASH160 973674c24f12f79fa05d14d3412405f217380f70 OP_EQUALVERIFY OP_CHECKSIG" } ] } The same in HEX: 0100000003c9ae7bf287c1e37704d2196c60448373ab0781ce4b58e80ce3353165e30b0a8e010000006a473044022044a9c1b6a0fca6765fa4fb3fe3c5af72a643558e3e9bf39f1538becc65816df202202f1f11648988700ad9dc9089f877d86b95509cbd55535b1953725e01c1d195880121022ff0fb2a8c5861b35388d6514161db26e90bb18b04c05f5cb3a57e722831e758ffffffff3399510040bdac939de76232c0c644202187c9d0e65612e3da470cf122b41a52000000006a47304402201a384cd1b3fa8df8eb95086e89cce9e90dd91e55a6eb7a126d71189725a3433002204f108b605a4b684bcc87c26cd461902a41d4c25cc5507a21f12426f10ae59a9c0121022ff0fb2a8c5861b35388d6514161db26e90bb18b04c05f5cb3a57e722831e758ffffffffc6149eeb04acb99cffa478489d429893c89aa860e0b5c3d3e85a873b622ba772000000006a47304402203d5168122ba377024ba7d69418f7dcf488a1745dd14ec184f01e7fe442b9fe7202200f4053c8ca5d84a77a77b4422c0a4e7857e90513ad478e36918122a3c0e7a9100121022ff0fb2a8c5861b35388d6514161db26e90bb18b04c05f5cb3a57e722831e758ffffffff0241890f00000000001976a91436668c34beb6abebb83dcb6c41a6518be412acab88acfa030000000000001976a914973674c24f12f79fa05d14d3412405f217380f7088ac00000000

Broadcasting code is the same for MainNet & TestNet:

 var network = account.UseTestNet ? Network.TestNet : Network.Main;
 var client = new QBitNinjaClient(network);
var broadcastResponse = await client.Broadcast(tx);
if (!broadcastResponse.Success)
{
  var message = $"ErrorCode: {broadcastResponse.Error.ErrorCode}; Reason: {broadcastResponse.Error.Reason};";
  throw new Exception(message);
}

I get broadcastResponse.Success is true but broadcastResponse.Error is INVALID & broadcastResponse.Reason is Unknown

Thx in advance.

It seems it stopped broadcasting from the beginning of September

NicolasDorier commented 6 years ago

I restarted the indexer, let me know. (this is strange though, as the logic behind it is just sending to RPC so there should not have issues)

NicolasDorier commented 6 years ago

Mh I could reproduce, checking it.

NicolasDorier commented 6 years ago

Ok so your transaction has indeed an issue (mempool conflict). I just pushed a commit so that it give you back a proper error now.

NicolasDorier commented 6 years ago

Closing this, reopen if it does not solve your issue.