diff --git a/src/machi.proto b/src/machi.proto index a3afde8..f59e293 100644 --- a/src/machi.proto +++ b/src/machi.proto @@ -304,16 +304,17 @@ message Mpb_ProjectionV1 { required bytes epoch_csum = 2; required string author_server = 3; repeated string all_members = 4; - required Mpb_Now creation_time = 5; - required Mpb_Mode mode = 6; - repeated string upi = 7; - repeated string repairing = 8; - repeated string down = 9; - optional bytes opaque_flap = 10; - optional bytes opaque_inner = 11; - required bytes opaque_dbg = 12; - required bytes opaque_dbg2 = 13; - repeated Mpb_MembersDictEntry members_dict = 14; + repeated string witnesses = 5; + required Mpb_Now creation_time = 6; + required Mpb_Mode mode = 7; + repeated string upi = 8; + repeated string repairing = 9; + repeated string down = 10; + optional bytes opaque_flap = 11; + optional bytes opaque_inner = 12; + required bytes opaque_dbg = 13; + required bytes opaque_dbg2 = 14; + repeated Mpb_MembersDictEntry members_dict = 15; } ////////////////////////////////////////// diff --git a/src/machi_chain_manager1.erl b/src/machi_chain_manager1.erl index 5afcba9..53fe1fb 100644 --- a/src/machi_chain_manager1.erl +++ b/src/machi_chain_manager1.erl @@ -215,7 +215,7 @@ init({MyName, InitMembersDict, MgrOpts}) -> random:seed(now()), init_remember_partition_hack(), ZeroAll_list = [P#p_srvr.name || {_,P} <- orddict:to_list(InitMembersDict)], - ZeroProj = make_none_projection(MyName, ZeroAll_list, InitMembersDict), + ZeroProj = make_none_projection(MyName, ZeroAll_list, [], InitMembersDict), ok = store_zeroth_projection_maybe(ZeroProj, MgrOpts), {MembersDict, Proj} = @@ -360,10 +360,11 @@ code_change(_OldVsn, S, _Extra) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -make_none_projection(MyName, All_list, MembersDict) -> +make_none_projection(MyName, All_list, Witness_list, MembersDict) -> Down_list = All_list, UPI_list = [], - machi_projection:new(MyName, MembersDict, Down_list, UPI_list, [], []). + P = machi_projection:new(MyName, MembersDict, Down_list, UPI_list, [], []), + machi_projection:update_checksum(P#projection_v1{witnesses=Witness_list}). get_my_private_proj_boot_info(MgrOpts, DefaultDict, DefaultProj) -> get_my_proj_boot_info(MgrOpts, DefaultDict, DefaultProj, private). @@ -666,7 +667,8 @@ calc_projection(_OldThreshold, _NoPartitionThreshold, LastProj, P = case NewUPI -- OldWitness_list of [] -> io:format(user, "\nNONE proj ~p\n", [OldEpochNum+1]), - NP = make_none_projection(MyName, OldAll_list, MembersDict), + NP = make_none_projection(MyName, OldAll_list, OldWitness_list, + MembersDict), NP#projection_v1{epoch_number=OldEpochNum + 1}; _ -> machi_projection:new(OldEpochNum + 1, @@ -1549,7 +1551,8 @@ react_to_env_C103(#projection_v1{epoch_number=Epoch_latest, #projection_v1{epoch_number=Epoch_latest, all_members=All_list, members_dict=MembersDict} = P_latest, - P_none0 = make_none_projection(MyName, All_list, MembersDict), + #projection_v1{witnesses=Witness_list} = P_current, + P_none0 = make_none_projection(MyName, All_list, Witness_list, MembersDict), P_none1 = P_none0#projection_v1{epoch_number=Epoch_latest, dbg=[{none_projection,true}]}, P_none = machi_projection:update_checksum(P_none1), diff --git a/src/machi_pb_translate.erl b/src/machi_pb_translate.erl index adab3cf..c8024a8 100644 --- a/src/machi_pb_translate.erl +++ b/src/machi_pb_translate.erl @@ -693,6 +693,7 @@ conv_to_projection_v1(#mpb_projectionv1{epoch_number=Epoch, epoch_csum=CSum, author_server=Author, all_members=AllMembers, + witnesses=Witnesses, creation_time=CTime, mode=Mode, upi=UPI, @@ -707,6 +708,7 @@ conv_to_projection_v1(#mpb_projectionv1{epoch_number=Epoch, epoch_csum=CSum, author_server=to_atom(Author), all_members=[to_atom(X) || X <- AllMembers], + witnesses=[to_atom(X) || X <- Witnesses], creation_time=conv_to_now(CTime), mode=conv_to_mode(Mode), upi=[to_atom(X) || X <- UPI], @@ -863,6 +865,7 @@ conv_from_projection_v1(#projection_v1{epoch_number=Epoch, epoch_csum=CSum, author_server=Author, all_members=AllMembers, + witnesses=Witnesses, creation_time=CTime, mode=Mode, upi=UPI, @@ -877,6 +880,7 @@ conv_from_projection_v1(#projection_v1{epoch_number=Epoch, epoch_csum=CSum, author_server=to_list(Author), all_members=[to_list(X) || X <- AllMembers], + witnesses=[to_list(X) || X <- Witnesses], creation_time=conv_from_now(CTime), mode=conv_from_mode(Mode), upi=[to_list(X) || X <- UPI],