File tree Expand file tree Collapse file tree 5 files changed +13
-10
lines changed
Expand file tree Collapse file tree 5 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ pub struct BackupChunk {
7575 pub chunk_index : u32 ,
7676 #[ n( 1 ) ]
7777 pub total_chunks : u32 ,
78- #[ n( 2 ) ]
78+ #[ cbor ( n( 2 ) , with = "minicbor::bytes" ) ]
7979 pub data : Vec < u8 > ,
8080}
8181
Original file line number Diff line number Diff line change @@ -12,15 +12,15 @@ pub struct SignPsbt {
1212pub struct AccountUpdate {
1313 #[ n( 0 ) ]
1414 pub account_id : String ,
15- #[ n( 1 ) ]
15+ #[ cbor ( n( 1 ) , with = "minicbor::bytes" ) ]
1616 pub update : Vec < u8 > ,
1717}
1818
1919#[ quantum_link]
2020pub struct BroadcastTransaction {
2121 #[ n( 0 ) ]
2222 pub account_id : String ,
23- #[ n( 1 ) ]
23+ #[ cbor ( n( 1 ) , with = "minicbor::bytes" ) ]
2424 pub psbt : Vec < u8 > ,
2525}
2626
Original file line number Diff line number Diff line change @@ -52,9 +52,6 @@ pub enum FirmwareFetchEvent {
5252 // envoy is sending a chunk for an update patch
5353 #[ n( 3 ) ]
5454 Chunk ( #[ n( 0 ) ] FirmwareChunk ) ,
55- // envoy has sent all the update patches
56- #[ n( 4 ) ]
57- Complete ,
5855 // envoy failed
5956 #[ n( 5 ) ]
6057 Error ( #[ n( 0 ) ] String ) ,
@@ -71,10 +68,16 @@ pub struct FirmwareChunk {
7168 pub chunk_index : u16 ,
7269 #[ n( 3 ) ]
7370 pub total_chunks : u16 ,
74- #[ n( 4 ) ]
71+ #[ cbor ( n( 4 ) , with = "minicbor::bytes" ) ]
7572 pub data : Vec < u8 > ,
7673}
7774
75+ impl FirmwareChunk {
76+ pub fn is_last ( & self ) -> bool {
77+ self . patch_index == self . total_patches - 1 && self . chunk_index == self . total_chunks - 1
78+ }
79+ }
80+
7881#[ quantum_link]
7982pub enum FirmwareUpdateResult {
8083 #[ n( 0 ) ]
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ pub struct PairingResponse {
2121
2222#[ quantum_link]
2323pub struct PairingRequest {
24- #[ n( 0 ) ]
24+ #[ cbor ( n( 0 ) , with = "minicbor::bytes" ) ]
2525 pub xid_document : Vec < u8 > ,
2626 #[ n( 1 ) ]
2727 pub device_name : String ,
Original file line number Diff line number Diff line change @@ -18,15 +18,15 @@ pub enum SecurityCheck {
1818
1919#[ quantum_link]
2020pub struct ChallengeRequest {
21- #[ n( 0 ) ]
21+ #[ cbor ( n( 0 ) , with = "minicbor::bytes" ) ]
2222 pub data : Vec < u8 > ,
2323}
2424
2525#[ quantum_link]
2626pub enum ChallengeResponseResult {
2727 #[ n( 0 ) ]
2828 Success {
29- #[ n( 0 ) ]
29+ #[ cbor ( n( 0 ) , with = "minicbor::bytes" ) ]
3030 data : Vec < u8 > ,
3131 } ,
3232 #[ n( 1 ) ]
You can’t perform that action at this time.
0 commit comments