Merge pull request #1 from oipwg/update-fcoin

Update fcoin to 1.1.0
This commit is contained in:
Sky Young 2019-07-25 10:40:50 -06:00 committed by GitHub
commit f1ef06879e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 594 additions and 10023 deletions

View File

@ -1,6 +1,7 @@
'use strict';
var bitcore = require('flocore-lib');
var fcoin = require('fcoin');
var Inventory = require('../inventory');
function builder(options) {
@ -15,9 +16,9 @@ function builder(options) {
options.network = bitcore.Networks.defaultNetwork;
}
options.Block = options.Block || bitcore.Block;
options.Block = options.Block || fcoin.Block;
options.BlockHeader = options.BlockHeader || bitcore.BlockHeader;
options.Transaction = options.Transaction || bitcore.Transaction;
options.Transaction = options.Transaction || fcoin.TX;
options.MerkleBlock = options.MerkleBlock || bitcore.MerkleBlock;
options.protocolVersion = options.protocolVersion || 70001;

View File

@ -26,7 +26,7 @@ function BlockMessage(arg, options) {
inherits(BlockMessage, Message);
BlockMessage.prototype.setPayload = function(payload) {
if (this.Block.prototype.fromRaw) {
if (typeof this.Block.fromRaw === 'function') {
this.block = this.Block.fromRaw(payload);
} else {
this.block = this.Block.fromBuffer(payload);
@ -34,7 +34,7 @@ BlockMessage.prototype.setPayload = function(payload) {
};
BlockMessage.prototype.getPayload = function() {
if (this.Block.prototype.toRaw) {
if (typeof this.Block.fromRaw === 'function') {
return this.block.toRaw();
}
return this.block.toBuffer();

View File

@ -3,7 +3,6 @@
var Message = require('../message');
var inherits = require('util').inherits;
var bitcore = require('flocore-lib');
var bcoin = require('fcoin');
var $ = bitcore.util.preconditions;
var _ = bitcore.deps._;
@ -29,8 +28,8 @@ function TransactionMessage(arg, options) {
inherits(TransactionMessage, Message);
TransactionMessage.prototype.setPayload = function(payload) {
if (this.Transaction.prototype.fromRaw) {
this.transaction = bcoin.tx.fromRaw(payload);
if (typeof this.Transaction.fromRaw === 'function') {
this.transaction = this.Transaction.fromRaw(payload);
} else if (this.Transaction.prototype.fromBuffer) {
this.transaction = new this.Transaction().fromBuffer(payload);
} else {
@ -39,7 +38,7 @@ TransactionMessage.prototype.setPayload = function(payload) {
};
TransactionMessage.prototype.getPayload = function() {
if (this.Transaction.prototype.toRaw) {
if (typeof this.Transaction.fromRaw === 'function') {
return this.transaction.toRaw();
}
return this.transaction.toBuffer();

10595
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "flocore-p2p",
"version": "5.0.0-beta.6",
"version": "5.0.0-beta.8",
"description": "Interface to the Flo P2P network for flocore",
"main": "index.js",
"scripts": {
@ -18,10 +18,10 @@
"url": "https://github.com/bitpay/bitcore-p2p.git"
},
"dependencies": {
"flocore-lib": "0.15.1",
"fcoin": "1.0.0-beta.18",
"bloom-filter": "^0.2.0",
"buffers": "bitpay/node-buffers#v0.1.2-bitpay",
"fcoin": "^1.1.0",
"flocore-lib": "^0.15.2",
"socks5-client": "^0.3.6"
},
"devDependencies": {