@@ -697,8 +697,41 @@ public void sendFeeGathering() {
697
697
.thenReturn (null );
698
698
// successful sendFeeGathering
699
699
score .invoke (owner , "sendFeeGathering" );
700
+ }
701
+
702
+ @ Test
703
+ public void handleRelayMessageMultipleChain () {
704
+ String arcticLink = getDestinationBTPAddress ("0x228.arctic" , "0x1111111111111111111111111111111111111111" );
705
+ String bscLink = getDestinationBTPAddress ("0x38.bsc" , "0x0000000000000000000000000000000000000004" );
706
+ Account relay = registerRelayer ();
707
+
708
+ addLink (arcticLink );
709
+ addLink (bscLink );
710
+
711
+ score .invoke (owner , "addRelay" , arcticLink , relay .getAddress ());
712
+
713
+ // for confirmation in eventLog
714
+ BTPAddress d = new BTPAddress ("0x38.bsc" , "0x0000000000000000000000000000000000000004" );
715
+ BTPAddress s = new BTPAddress ("0x228.arctic" , "0x1111111111111111111111111111111111111111" );
716
+
717
+ BTPMessage m = new BTPMessage ();
718
+ m .setSrc (s );
719
+ m .setDst (d );
720
+ m .setSn (BigInteger .valueOf (10 ));
721
+ m .setSvc ("bts" );
722
+ m .setPayload ("messageToBTS" .getBytes ());
723
+ byte [] byt = m .toBytes ();
724
+
725
+ /* This base64 message was generated from the BTP Message above */
726
+ String base64 = "-N743Lja-NhVuND4zvjMuDlidHA6Ly8weDEuaWNvbi9jeDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDQBuI74jLg9YnRwOi8vMHgyMjguYXJjdGljLzB4MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMbg5YnRwOi8vMHgzOC5ic2MvMHgwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA0g2J0cwqMbWVzc2FnZVRvQlRThAFK_nM=" ;
727
+
728
+ score .invoke (relay , "handleRelayMessage" , arcticLink , base64 );
700
729
730
+ // though the service type is "bts", bts does not need to be registered as service on ICON
731
+ // as it is intended for bts of destination BSC chain
732
+ // ICON just forwards the message to BSC using Message event with required data
701
733
734
+ verify (scoreSpy ).Message (eq (bscLink ), eq (BigInteger .TWO ), eq (byt ));
702
735
}
703
736
704
737
@ Test
0 commit comments