Merge rust-bitcoin/rust-bitcoin#996: Box value encoded in a variant to reduce enum stack space
9906cea14c
Box value encoded in a variant to reduce enum stack space (Riccardo Casatta) Pull request description: 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 ``` `util::psbt::error::Error` is wrapped also in `consensus::encode::Error` and stack savings are gained there also ACKs for top commit: apoelstra: ACK9906cea14c
tcharding: ACK9906cea14c
sanket1729: utACK9906cea14c
Tree-SHA512: e03988fcbc3dd87f83d00dd84ec1c538bc5c63bea97ff4a69a715621f498f57d7fe2a623e351942d9532af40c723e42a9eb6ef48ebf4c62ddf5c0f44e9ea0a07
This commit is contained in:
commit
2b1154cefe
|
@ -80,7 +80,7 @@ pub enum Error {
|
|||
},
|
||||
/// Conflicting data during combine procedure:
|
||||
/// global extended public key has inconsistent key sources
|
||||
CombineInconsistentKeySources(ExtendedPubKey),
|
||||
CombineInconsistentKeySources(Box<ExtendedPubKey>),
|
||||
/// Serialization error in bitcoin consensus-encoded structures
|
||||
ConsensusEncoding,
|
||||
}
|
||||
|
|
|
@ -192,7 +192,7 @@ impl PartiallySignedTransaction {
|
|||
entry.insert((fingerprint1, derivation1));
|
||||
continue
|
||||
}
|
||||
return Err(Error::CombineInconsistentKeySources(xpub));
|
||||
return Err(Error::CombineInconsistentKeySources(Box::new(xpub)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue