copyWith method

BlockHeader copyWith({
  1. int? version,
  2. Hash? prevBlock,
  3. Hash? merkleRoot,
  4. DateTime? timestamp,
  5. int? bits,
  6. int? nonce,
})

Creates a copy of this block header with optional field overrides.

Implementation

BlockHeader copyWith({
  int? version,
  Hash? prevBlock,
  Hash? merkleRoot,
  DateTime? timestamp,
  int? bits,
  int? nonce,
}) {
  return BlockHeader(
    version: version ?? this.version,
    prevBlock: prevBlock ?? this.prevBlock,
    merkleRoot: merkleRoot ?? this.merkleRoot,
    timestamp: timestamp ?? this.timestamp,
    bits: bits ?? this.bits,
    nonce: nonce ?? this.nonce,
  );
}