File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -31,9 +31,12 @@ pub mod connected {
3131 pda. sub_lamports ( amount / 2 ) ?;
3232 ctx. accounts . random_wallet . add_lamports ( amount / 2 ) ?;
3333
34- // Check if the message is "revert" and return an error if so
35- if pda. last_message == "revert" {
36- msg ! ( "Reverting transaction due to 'revert' message." ) ;
34+ // Check if the message contains "revert" and return an error if so
35+ if pda. last_message . contains ( "revert" ) {
36+ msg ! (
37+ "Reverting transaction due to message: '{}'" ,
38+ pda. last_message
39+ ) ;
3740 return Err ( ErrorCode :: RevertMessage . into ( ) ) ;
3841 }
3942
Original file line number Diff line number Diff line change @@ -45,9 +45,12 @@ pub mod connected_spl {
4545
4646 transfer_checked ( xfer_ctx, amount / 2 , 6 ) ?;
4747
48- // Check if the message is "revert" and return an error if so
49- if pda. last_message == "revert" {
50- msg ! ( "Reverting transaction due to 'revert' message." ) ;
48+ // Check if the message contains "revert" and return an error if so
49+ if pda. last_message . contains ( "revert" ) {
50+ msg ! (
51+ "Reverting transaction due to message: '{}'" ,
52+ pda. last_message
53+ ) ;
5154 return Err ( ErrorCode :: RevertMessage . into ( ) ) ;
5255 }
5356
You can’t perform that action at this time.
0 commit comments