fix: favor Babbage over Conway for tx decoding (#389)
This commit is contained in:
parent
700d109d31
commit
7f0e022f1d
1 changed files with 6 additions and 2 deletions
|
|
@ -64,13 +64,17 @@ impl<'b> MultiEraTx<'b> {
|
|||
/// Try decode a transaction via every era's encoding format, starting with
|
||||
/// the most recent and returning on first success, or None if none are
|
||||
/// successful
|
||||
///
|
||||
/// NOTE: Until Conway is officially released, this method favors Babbage
|
||||
/// decoding over Conway decoding. This means that we'll attempt to
|
||||
/// decode using Babbage first even if Conway is newer.
|
||||
pub fn decode(cbor: &'b [u8]) -> Result<Self, Error> {
|
||||
if let Ok(tx) = minicbor::decode(cbor) {
|
||||
return Ok(MultiEraTx::Conway(Box::new(Cow::Owned(tx))));
|
||||
return Ok(MultiEraTx::Babbage(Box::new(Cow::Owned(tx))));
|
||||
}
|
||||
|
||||
if let Ok(tx) = minicbor::decode(cbor) {
|
||||
return Ok(MultiEraTx::Babbage(Box::new(Cow::Owned(tx))));
|
||||
return Ok(MultiEraTx::Conway(Box::new(Cow::Owned(tx))));
|
||||
}
|
||||
|
||||
if let Ok(tx) = minicbor::decode(cbor) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue