public Block(Block block, bool thawChildren) { ContractsCommon.NotNull(block, "block"); Contract.Ensures(this.Version == block.Version); Contract.Ensures(this.PreviousBlockHash == block.PreviousBlockHash); Contract.Ensures(this.Timestamp == block.Timestamp); Contract.Ensures(this.DifficultyBits == block.DifficultyBits); Contract.Ensures(this.Nonce == block.Nonce); Contract.Ensures(this.Transactions.SequencedEquals(block.Transactions)); Contract.Ensures(this.MerkleRoot == block.MerkleRoot); ContractsCommon.ChildrenThawed(Transactions, thawChildren); this._version = block._version; this._previousBlockHash = block._previousBlockHash; this._timestamp = block._timestamp; this._difficultyBits = block._difficultyBits; this._nonce = block._nonce; if (block._merkleTree != null) { var tree = new ArrayList <Hash256>(block._merkleTree.Count); tree.AddAll(block._merkleTree); this._merkleTree = new GuardedList <Hash256>(tree); } var transactions = new HashedArrayList <Transaction>(block.Transactions.Count); transactions.AddAll(FreezableExtensions.ThawChildren(block.Transactions, thawChildren)); transactions.CollectionChanged += InvalidateMerkleTree; this.Transactions = transactions; }
public TransactionOutput(TransactionOutput txOut, bool thawChildren) { ContractsCommon.NotNull(txOut, "txOut"); ContractsCommon.ChildThawed(Script, thawChildren); _value = txOut._value; _script = FreezableExtensions.ThawChild(txOut._script, thawChildren); }
public TransactionInput(TransactionInput txIn, bool thawChildren) { ContractsCommon.NotNull(txIn, "txIn"); ContractsCommon.ChildThawed(Source, thawChildren); ContractsCommon.ChildThawed(Script, thawChildren); _source = FreezableExtensions.ThawChild(txIn._source, thawChildren); _script = FreezableExtensions.ThawChild(txIn._script, thawChildren); _sequenceNumber = txIn._sequenceNumber; }
public Transaction(Transaction tx, bool thawChildren) { ContractsCommon.NotNull(tx, "tx"); ContractsCommon.ChildrenThawed(TransactionInputs, thawChildren); ContractsCommon.ChildrenThawed(TransactionOutputs, thawChildren); Version = tx.Version; var transactionInputs = new ArrayList <TransactionInput>(tx.TransactionInputs.Count); transactionInputs.AddAll(FreezableExtensions.ThawChildren(tx.TransactionInputs, thawChildren)); transactionInputs.CollectionChanged += InputOutputChanged; TransactionInputs = transactionInputs; var transactionOutputs = new ArrayList <TransactionOutput>(tx.TransactionOutputs.Count); transactionOutputs.AddAll(FreezableExtensions.ThawChildren(tx.TransactionOutputs, thawChildren)); transactionOutputs.CollectionChanged += InputOutputChanged; TransactionOutputs = transactionOutputs; LockTime = tx.LockTime; }