9494
9595 // Valid checks whether a channel proposal is valid.
9696 Valid () error
97-
98- // ProposalID calculates the proposal's unique identifier.
99- ProposalID () ProposalID
10097 }
10198
10299 // BaseChannelProposal contains all data necessary to propose a new
@@ -105,7 +102,7 @@ type (
105102 // BaseChannelProposal implements the channel proposal messages from the
106103 // Multi-Party Channel Proposal Protocol (MPCPP).
107104 BaseChannelProposal struct {
108- proposalID ProposalID // Unique ID for the proposal.
105+ ProposalID ProposalID // Unique ID for the proposal.
109106 ChallengeDuration uint64 // Dispute challenge duration.
110107 NonceShare NonceShare // Proposer's channel nonce share.
111108 App channel.App // App definition, or nil.
@@ -183,11 +180,6 @@ func makeBaseChannelProposal(
183180 }, nil
184181}
185182
186- // ProposalID returns the proposal id for this channel proposal.
187- func (p * BaseChannelProposal ) ProposalID () ProposalID {
188- return p .proposalID
189- }
190-
191183// Base returns the channel proposal's common values.
192184func (p * BaseChannelProposal ) Base () * BaseChannelProposal {
193185 return p
@@ -201,7 +193,7 @@ func (p BaseChannelProposal) NumPeers() int {
201193// Encode encodes the BaseChannelProposal into an io.Writer.
202194func (p BaseChannelProposal ) Encode (w io.Writer ) error {
203195 optAppAndDataEnc := channel.OptAppAndDataEnc {App : p .App , Data : p .InitData }
204- return perunio .Encode (w , p .ProposalID () , p .ChallengeDuration , p .NonceShare ,
196+ return perunio .Encode (w , p .ProposalID , p .ChallengeDuration , p .NonceShare ,
205197 optAppAndDataEnc , p .InitBals , p .FundingAgreement )
206198}
207199
@@ -211,7 +203,7 @@ func (p *BaseChannelProposal) Decode(r io.Reader) (err error) {
211203 p .InitBals = new (channel.Allocation )
212204 }
213205 optAppAndDataDec := channel.OptAppAndDataDec {App : & p .App , Data : & p .InitData }
214- return perunio .Decode (r , & p .proposalID , & p .ChallengeDuration , & p .NonceShare ,
206+ return perunio .Decode (r , & p .ProposalID , & p .ChallengeDuration , & p .NonceShare ,
215207 optAppAndDataDec , p .InitBals , & p .FundingAgreement )
216208}
217209
@@ -242,12 +234,12 @@ func (p LedgerChannelProposalMsg) Accept(
242234 nonceShare ProposalOpts ,
243235) * LedgerChannelProposalAccMsg {
244236 if ! nonceShare .isNonce () {
245- log .WithField ("proposal" , p .ProposalID () ).
237+ log .WithField ("proposal" , p .ProposalID ).
246238 Panic ("LedgerChannelProposal.Accept: nonceShare has no configured nonce" )
247239 }
248240 return & LedgerChannelProposalAccMsg {
249241 BaseChannelProposalAcc : makeBaseChannelProposalAcc (
250- p .ProposalID () , nonceShare .nonce ()),
242+ p .ProposalID , nonceShare .nonce ()),
251243 Participant : participant ,
252244 }
253245}
@@ -370,14 +362,13 @@ func (SubChannelProposalMsg) Type() wire.Type {
370362func (p SubChannelProposalMsg ) Accept (
371363 nonceShare ProposalOpts ,
372364) * SubChannelProposalAccMsg {
373- propID := p .ProposalID ()
374365 if ! nonceShare .isNonce () {
375- log .WithField ("proposal" , propID ).
366+ log .WithField ("proposal" , p . ProposalID ).
376367 Panic ("SubChannelProposal.Accept: nonceShare has no configured nonce" )
377368 }
378369 return & SubChannelProposalAccMsg {
379370 BaseChannelProposalAcc : makeBaseChannelProposalAcc (
380- propID , nonceShare .nonce ()),
371+ p . ProposalID , nonceShare .nonce ()),
381372 }
382373}
383374
@@ -600,10 +591,9 @@ func (p VirtualChannelProposalMsg) Accept(
600591 responder wallet.Address ,
601592 opts ... ProposalOpts ,
602593) * VirtualChannelProposalAccMsg {
603- propID := p .ProposalID ()
604594 _opts := union (opts ... )
605595 return & VirtualChannelProposalAccMsg {
606- BaseChannelProposalAcc : makeBaseChannelProposalAcc (propID , _opts .nonce ()),
596+ BaseChannelProposalAcc : makeBaseChannelProposalAcc (p . ProposalID , _opts .nonce ()),
607597 Responder : responder ,
608598 }
609599}
0 commit comments