File tree 5 files changed +1618
-11047
lines changed
5 files changed +1618
-11047
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
3
var bitcore = require ( 'flocore-lib' ) ;
4
+ var fcoin = require ( 'fcoin' ) ;
4
5
var Inventory = require ( '../inventory' ) ;
5
6
6
7
function builder ( options ) {
@@ -15,9 +16,9 @@ function builder(options) {
15
16
options . network = bitcore . Networks . defaultNetwork ;
16
17
}
17
18
18
- options . Block = options . Block || bitcore . Block ;
19
+ options . Block = options . Block || fcoin . Block ;
19
20
options . BlockHeader = options . BlockHeader || bitcore . BlockHeader ;
20
- options . Transaction = options . Transaction || bitcore . Transaction ;
21
+ options . Transaction = options . Transaction || fcoin . TX ;
21
22
options . MerkleBlock = options . MerkleBlock || bitcore . MerkleBlock ;
22
23
options . protocolVersion = options . protocolVersion || 70001 ;
23
24
Original file line number Diff line number Diff line change @@ -26,15 +26,15 @@ function BlockMessage(arg, options) {
26
26
inherits ( BlockMessage , Message ) ;
27
27
28
28
BlockMessage . prototype . setPayload = function ( payload ) {
29
- if ( this . Block . prototype . fromRaw ) {
29
+ if ( typeof this . Block . fromRaw === 'function' ) {
30
30
this . block = this . Block . fromRaw ( payload ) ;
31
31
} else {
32
32
this . block = this . Block . fromBuffer ( payload ) ;
33
33
}
34
34
} ;
35
35
36
36
BlockMessage . prototype . getPayload = function ( ) {
37
- if ( this . Block . prototype . toRaw ) {
37
+ if ( typeof this . Block . fromRaw === 'function' ) {
38
38
return this . block . toRaw ( ) ;
39
39
}
40
40
return this . block . toBuffer ( ) ;
Original file line number Diff line number Diff line change 3
3
var Message = require ( '../message' ) ;
4
4
var inherits = require ( 'util' ) . inherits ;
5
5
var bitcore = require ( 'flocore-lib' ) ;
6
- var bcoin = require ( 'fcoin' ) ;
7
6
var $ = bitcore . util . preconditions ;
8
7
var _ = bitcore . deps . _ ;
9
8
@@ -29,8 +28,8 @@ function TransactionMessage(arg, options) {
29
28
inherits ( TransactionMessage , Message ) ;
30
29
31
30
TransactionMessage . prototype . setPayload = function ( payload ) {
32
- if ( this . Transaction . prototype . fromRaw ) {
33
- this . transaction = bcoin . tx . fromRaw ( payload ) ;
31
+ if ( typeof this . Transaction . fromRaw === 'function' ) {
32
+ this . transaction = this . Transaction . fromRaw ( payload ) ;
34
33
} else if ( this . Transaction . prototype . fromBuffer ) {
35
34
this . transaction = new this . Transaction ( ) . fromBuffer ( payload ) ;
36
35
} else {
@@ -39,7 +38,7 @@ TransactionMessage.prototype.setPayload = function(payload) {
39
38
} ;
40
39
41
40
TransactionMessage . prototype . getPayload = function ( ) {
42
- if ( this . Transaction . prototype . toRaw ) {
41
+ if ( typeof this . Transaction . fromRaw === 'function' ) {
43
42
return this . transaction . toRaw ( ) ;
44
43
}
45
44
return this . transaction . toBuffer ( ) ;
You can’t perform that action at this time.
0 commit comments