File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -194,8 +194,8 @@ export class Config {
194
194
// TODO: map chainParams (and lib/util.parseParams) to new Common format
195
195
const common =
196
196
options . common ?? new Common ( { chain : Config . CHAIN_DEFAULT , hardfork : 'chainstart' } )
197
- this . chainCommon = Object . assign ( Object . create ( Object . getPrototypeOf ( common ) ) , common )
198
- this . execCommon = Object . assign ( Object . create ( Object . getPrototypeOf ( common ) ) , common )
197
+ this . chainCommon = common . copy ( )
198
+ this . execCommon = common . copy ( )
199
199
200
200
this . discDns = this . getDnsDiscovery ( options . discDns )
201
201
this . discV4 = this . getV4Discovery ( options . discV4 )
Original file line number Diff line number Diff line change @@ -742,4 +742,11 @@ export default class Common extends EventEmitter {
742
742
consensusConfig ( ) : any {
743
743
return ( < any > this . _chainParams ) [ 'consensus' ] [ this . consensusAlgorithm ( ) ]
744
744
}
745
+
746
+ /**
747
+ * Returns a deep copy of this common instance.
748
+ */
749
+ copy ( ) : Common {
750
+ return Object . assign ( Object . create ( Object . getPrototypeOf ( this ) ) , this )
751
+ }
745
752
}
Original file line number Diff line number Diff line change @@ -46,10 +46,7 @@ export abstract class BaseTransaction<TransactionObject> {
46
46
47
47
this . _validateExceedsMaxInteger ( validateCannotExceedMaxInteger )
48
48
49
- this . common =
50
- ( txOptions . common &&
51
- Object . assign ( Object . create ( Object . getPrototypeOf ( txOptions . common ) ) , txOptions . common ) ) ??
52
- new Common ( { chain : 'mainnet' } )
49
+ this . common = txOptions . common ?. copy ( ) ?? new Common ( { chain : 'mainnet' } )
53
50
}
54
51
55
52
/**
You can’t perform that action at this time.
0 commit comments