Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't broadcast serialized transaction #20

Open
maraoz opened this issue May 5, 2015 · 3 comments
Open

can't broadcast serialized transaction #20

maraoz opened this issue May 5, 2015 · 3 comments

Comments

@maraoz
Copy link
Contributor

maraoz commented May 5, 2015

the following code results in an error:

'use strict';

var bitcore = require('bitcore');
var explorers = require('bitcore-explorers');
var insight = new explorers.Insight();

var Transaction = bitcore.Transaction;

var tx = new Transaction('0100000001c54cd2b468b0a0e24f573ee10bedfd7500c7079bf98c1ec7d56b330147d6f188000000006b48304502210091126306c144d97b7c811f0d7db535ae8ce709739b87ed2afda23418429adcb602202fe57542741477f02d4d42d3050dc71975840dff74c20ebbfcc6ca1773a044fd012102b9740162829af19408920ad4111298b98795b911d37514d975ac1912578545fcffffffff02074c0f00000000001976a9145ffd525ef01e229497e56b189fdd2a42bd36ba6688ace96de605000000001976a9145ffd525ef01e229497e56b189fdd2a42bd36ba6688ac00000000');
console.log(tx);
insight.broadcast(tx, function(err, txid) {
  if (err) {
    throw err;
  }
  console.log(txid);
});

and...

$ node broadcast.js 
<Transaction: 0100000001c54cd2b468b0a0e24f573ee10bedfd7500c7079bf98c1ec7d56b330147d6f188000000006b48304502210091126306c144d97b7c811f0d7db535ae8ce709739b87ed2afda23418429adcb602202fe57542741477f02d4d42d3050dc71975840dff74c20ebbfcc6ca1773a044fd012102b9740162829af19408920ad4111298b98795b911d37514d975ac1912578545fcffffffff02074c0f00000000001976a9145ffd525ef01e229497e56b189fdd2a42bd36ba6688ace96de605000000001976a9145ffd525ef01e229497e56b189fdd2a42bd36ba6688ac00000000>

/home/maraoz/git/segments/node_modules/bitcore/lib/transaction/transaction.js:723
        throw new errors.Transaction.Input.MissingPreviousOutput();
              ^
No previous output information.

Should work for an already serialized transaction

@braydonf
Copy link
Contributor

braydonf commented May 5, 2015

uncheckedSerialize()?

@maraoz
Copy link
Contributor Author

maraoz commented May 6, 2015

I think the problem is with the checks done on checkedSerialize... It tries to calculate fees when it's not always possible.

@braydonf
Copy link
Contributor

braydonf commented May 6, 2015

An immutable transaction bitpay/bitcore#1210 I think would help in this case as well.

var tx = new ImmutableTransaction('0100000001c54...');

There wouldn't be any serialization checks, and getting the hash of the tx would be faster and better for syncing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants