Skip to content

Commit 572e190

Browse files
committed
Box value encoded in a variant to reduce enum stack space
before ``` print-type-size type: `util::psbt::error::Error`: 120 bytes, alignment: 8 bytes print-type-size discriminant: 1 bytes print-type-size variant `CombineInconsistentKeySources`: 115 bytes print-type-size padding: 3 bytes print-type-size field `.0`: 112 bytes, alignment: 4 bytes print-type-size variant `InvalidKey`: 39 bytes print-type-size padding: 7 bytes print-type-size field `.0`: 32 bytes, alignment: 8 bytes ``` after ``` print-type-size type: `util::psbt::error::Error`: 40 bytes, alignment: 8 bytes print-type-size discriminant: 1 bytes print-type-size variant `InvalidKey`: 39 bytes print-type-size padding: 7 bytes print-type-size field `.0`: 32 bytes, alignment: 8 bytes print-type-size variant `DuplicateKey`: 39 bytes print-type-size padding: 7 bytes print-type-size field `.0`: 32 bytes, alignment: 8 bytes ```
1 parent 588e837 commit 572e190

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/util/psbt/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub enum Error {
8080
},
8181
/// Conflicting data during combine procedure:
8282
/// global extended public key has inconsistent key sources
83-
CombineInconsistentKeySources(ExtendedPubKey),
83+
CombineInconsistentKeySources(Box<ExtendedPubKey>),
8484
/// Serialization error in bitcoin consensus-encoded structures
8585
ConsensusEncoding,
8686
}

src/util/psbt/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ impl PartiallySignedTransaction {
194194
entry.insert((fingerprint1, derivation1));
195195
continue
196196
}
197-
return Err(Error::CombineInconsistentKeySources(xpub));
197+
return Err(Error::CombineInconsistentKeySources(Box::new(xpub)));
198198
}
199199
}
200200
}

0 commit comments

Comments
 (0)