792{
794 data_list.clear();
795 wait_reason.clear();
796
797
798
799
800
801 std::vector<uint32_t> auto_config_messages(m_num_authorized_signers, 0);
802 bool any_auto_config = false;
803
804 for (size_t i = 0; i < m_messages.size(); ++i)
805 {
808 {
809 if (auto_config_messages[m.signer_index] == 0)
810 {
811 auto_config_messages[m.signer_index] = m.id;
812 any_auto_config = true;
813 }
814
815 }
816 }
817
818 if (any_auto_config)
819 {
820 bool auto_config_complete = message_ids_complete(auto_config_messages);
821 if (auto_config_complete)
822 {
823 processing_data data;
825 data.message_ids = auto_config_messages;
826 data.message_ids.erase(data.message_ids.begin());
827 data_list.push_back(data);
828 return true;
829 }
830 else
831 {
832 wait_reason =
tr(
"Auto-config cannot proceed because auto config data from other signers is not complete");
833 return false;
834
835
836
837 }
838 }
839
840
841 for (size_t i = 0; i < m_messages.size(); ++i)
842 {
845 {
846 processing_data data;
848 data.message_ids.push_back(m.id);
849 data_list.push_back(data);
850 return true;
851 }
852 }
853
854
856 {
857 wait_reason =
tr(
"The signer config is not complete.");
858 return false;
859 }
860
861 if (!state.multisig)
862 {
863
865 {
866
867
868
869 processing_data data;
871 data_list.push_back(data);
872 return true;
873 }
874
875
876
877
878
879
880 std::vector<uint32_t> key_set_messages(m_num_authorized_signers, 0);
881
882 for (size_t i = 0; i < m_messages.size(); ++i)
883 {
886 && (m.round == 0))
887 {
888 if (key_set_messages[m.signer_index] == 0)
889 {
890 key_set_messages[m.signer_index] = m.id;
891 }
892
893 }
894 }
895
896 bool key_sets_complete = message_ids_complete(key_set_messages);
897 if (key_sets_complete)
898 {
899
900 processing_data data;
902 data.message_ids = key_set_messages;
903 data.message_ids.erase(data.message_ids.begin());
904 data_list.push_back(data);
905 return true;
906 }
907 else
908 {
909 wait_reason =
tr(
"Wallet can't go multisig because key sets from other signers are missing or not complete.");
910 return false;
911 }
912 }
913
914 if (state.multisig && !state.multisig_is_ready)
915 {
916
917
918
919
920
921
922
923 std::vector<uint32_t> additional_key_set_messages(m_num_authorized_signers, 0);
924
925 for (size_t i = 0; i < m_messages.size(); ++i)
926 {
929 && (m.round == state.multisig_rounds_passed))
930 {
931 if (additional_key_set_messages[m.signer_index] == 0)
932 {
933 additional_key_set_messages[m.signer_index] = m.id;
934 }
935
936 }
937 }
938
939 bool key_sets_complete = message_ids_complete(additional_key_set_messages);
940 if (key_sets_complete)
941 {
942 processing_data data;
944 data.message_ids = additional_key_set_messages;
945 data.message_ids.erase(data.message_ids.begin());
946 data_list.push_back(data);
947 return true;
948 }
949 else
950 {
951 wait_reason =
tr(
"Wallet can't start another key exchange round because key sets from other signers are missing or not complete.");
952 return false;
953 }
954 }
955
956
957
958
959
960
961
962
963
964
965
966
967
968 if (state.has_multisig_partial_key_images || force_sync)
969 {
970
971
972
973
974 bool own_sync_data_created = false;
975 std::vector<uint32_t> sync_messages(m_num_authorized_signers, 0);
976 for (size_t i = 0; i < m_messages.size(); ++i)
977 {
980
981
982 {
984 {
985 own_sync_data_created = true;
986
987 }
989 {
990 if (sync_messages[m.signer_index] == 0)
991 {
992 sync_messages[m.signer_index] = m.id;
993 }
994
995 }
996 }
997 }
998 if (!own_sync_data_created)
999 {
1000
1001
1002 processing_data data;
1004 data_list.push_back(data);
1005 return true;
1006 }
1008
1009 bool all_sync_data = id_count == (m_num_authorized_signers - 1);
1010
1011
1012
1013 bool enough_sync_data = id_count >= (m_num_required_signers - 1);
1014 bool sync = false;
1015 wait_reason =
tr(
"Syncing not done because multisig sync data from other signers are missing or not complete.");
1016 if (all_sync_data)
1017 {
1018 sync = true;
1019 }
1020 else if (enough_sync_data)
1021 {
1022 if (force_sync)
1023 {
1024 sync = true;
1025 }
1026 else
1027 {
1028
1029 wait_reason += (boost::format("\nUse \"mms next sync\" if you want to sync with just %s out of %s authorized signers and transact just with them")
1030 % (m_num_required_signers - 1) % (m_num_authorized_signers - 1)).str();
1031 }
1032 }
1033 if (sync)
1034 {
1035 processing_data data;
1037 for (size_t i = 0; i < sync_messages.size(); ++i)
1038 {
1040 if (id != 0)
1041 {
1042 data.message_ids.push_back(id);
1043 }
1044 }
1045 data_list.push_back(data);
1046 return true;
1047 }
1048 else
1049 {
1050
1051 return false;
1052 }
1053 }
1054
1055 bool waiting_found = false;
1056 bool note_found = false;
1057 bool sync_data_found = false;
1058 for (size_t i = 0; i < m_messages.size(); ++i)
1059 {
1062 {
1063 waiting_found = true;
1064 switch (m.type)
1065 {
1067 {
1068
1069 processing_data data;
1071 data.message_ids.push_back(m.id);
1072 data_list.push_back(data);
1073
1075 for (
uint32_t j = 1; j < m_num_authorized_signers; ++j)
1076 {
1077 data.receiving_signer_index = j;
1078 data_list.push_back(data);
1079 }
1080 return true;
1081 }
1082
1084 {
1085 if (m.signer_index == 0)
1086 {
1087
1088
1089
1090
1091
1092 processing_data data;
1094 data.message_ids.push_back(m.id);
1095 for (
uint32_t j = 1; j < m_num_authorized_signers; ++j)
1096 {
1097 data.receiving_signer_index = j;
1098 data_list.push_back(data);
1099 }
1100 return true;
1101 }
1102 else
1103 {
1104
1105
1106 processing_data data;
1108 data.message_ids.push_back(m.id);
1109 data_list.push_back(data);
1110 return true;
1111 }
1112 }
1113
1115 note_found = true;
1116 break;
1117
1119 sync_data_found = true;
1120 break;
1121
1122 default:
1123 break;
1124 }
1125 }
1126 }
1127 if (waiting_found)
1128 {
1129 wait_reason =
tr(
"There are waiting messages, but nothing is ready to process under normal circumstances");
1130 if (sync_data_found)
1131 {
1132 wait_reason +=
tr(
"\nUse \"mms next sync\" if you want to force processing of the waiting sync data");
1133 }
1134 if (note_found)
1135 {
1136 wait_reason +=
tr(
"\nUse \"mms note\" to display the waiting notes");
1137 }
1138 }
1139 else
1140 {
1141 wait_reason =
tr(
"There are no messages waiting to be processed.");
1142 }
1143
1144 return false;
1145}
bool signer_config_complete() const
@ process_auto_config_data