mirror of https://github.com/BTCPrivate/copay.git
add buildermockv0 to show old / obsolete tx proposals
This commit is contained in:
parent
7f11793b96
commit
2008db932b
|
@ -0,0 +1,26 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
|
var bitcore = require('bitcore');
|
||||||
|
var Transaction = bitcore.Transaction;
|
||||||
|
|
||||||
|
function BuilderMockV0 (data) {
|
||||||
|
this.vanilla = data;
|
||||||
|
this.tx = new Transaction();
|
||||||
|
this.tx.parse(new Buffer(data.tx, 'hex'));
|
||||||
|
};
|
||||||
|
|
||||||
|
BuilderMockV0.prototype.build = function() {
|
||||||
|
return this.tx;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
BuilderMockV0.prototype.getSelectedUnspent = function() {
|
||||||
|
return [];
|
||||||
|
};
|
||||||
|
|
||||||
|
BuilderMockV0.prototype.toObj = function() {
|
||||||
|
return this.vanilla;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = BuilderMockV0;
|
|
@ -6,6 +6,7 @@ var bitcore = require('bitcore');
|
||||||
var util = bitcore.util;
|
var util = bitcore.util;
|
||||||
var Transaction = bitcore.Transaction;
|
var Transaction = bitcore.Transaction;
|
||||||
var Builder = bitcore.TransactionBuilder;
|
var Builder = bitcore.TransactionBuilder;
|
||||||
|
var BuilderMockV0 = require('./BuilderMockV0');;
|
||||||
var Script = bitcore.Script;
|
var Script = bitcore.Script;
|
||||||
var buffertools = bitcore.buffertools;
|
var buffertools = bitcore.buffertools;
|
||||||
|
|
||||||
|
@ -45,8 +46,11 @@ TxProposal.fromObj = function(o) {
|
||||||
try {
|
try {
|
||||||
t.builder = new Builder.fromObj(o.builderObj);
|
t.builder = new Builder.fromObj(o.builderObj);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!process.version)
|
if (!o.version) {
|
||||||
console.log('Ignoring incompatible stored TxProposal:' + JSON.stringify(o.builderObj));
|
console.log('Importing old TxProposal V0' + JSON.stringify(o.builderObj));
|
||||||
|
t.builder = new BuilderMockV0(o.builderObj);
|
||||||
|
t.readonly = 1;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
};
|
};
|
||||||
|
|
|
@ -488,8 +488,11 @@ Wallet.prototype.getTxProposals = function() {
|
||||||
txp.finallyRejected = true;
|
txp.finallyRejected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (txp.readonly && !txp.finallyRejected && !txp.sentTs) {
|
||||||
|
} else {
|
||||||
ret.push(txp);
|
ret.push(txp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue