fix: favor Babbage over Conway for tx decoding (#389)
This commit is contained in:
parent
25bbb925b2
commit
5cf77c1c7b
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
|
/// 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
|
/// the most recent and returning on first success, or None if none are
|
||||||
/// successful
|
/// 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> {
|
pub fn decode(cbor: &'b [u8]) -> Result<Self, Error> {
|
||||||
if let Ok(tx) = minicbor::decode(cbor) {
|
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) {
|
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) {
|
if let Ok(tx) = minicbor::decode(cbor) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue