@@ -90,9 +90,11 @@ func (s *transactionServer) SubmitIntent(streamer transactionpb.Transaction_Subm
9090
9191 // Figure out what kind of intent we're operating on and initialize the intent handler
9292 var intentHandler interface {}
93+ var intentHasNewOwner bool // todo: intent handler should specify this
9394 switch submitActionsReq .Metadata .Type .(type ) {
9495 case * transactionpb.Metadata_OpenAccounts :
9596 log = log .WithField ("intent_type" , "open_accounts" )
97+ intentHasNewOwner = true
9698 intentHandler = NewOpenAccountsIntentHandler (s .conf , s .data , s .antispamGuard )
9799 case * transactionpb.Metadata_SendPublicPayment :
98100 log = log .WithField ("intent_type" , "send_public_payment" )
@@ -120,8 +122,6 @@ func (s *transactionServer) SubmitIntent(streamer transactionpb.Transaction_Subm
120122 }
121123 log = log .WithField ("submit_actions_owner_account" , submitActionsOwnerAccount .PublicKey ().ToBase58 ())
122124
123- // For all allowed cases of owner account types that can call SubmitIntent,
124- // we need to find the phone-verified user's 12 words who initiated the intent.
125125 var initiatorOwnerAccount * common.Account
126126 submitActionsOwnerMetadata , err := common .GetOwnerMetadata (ctx , s .data , submitActionsOwnerAccount )
127127 if err == nil {
@@ -164,17 +164,15 @@ func (s *transactionServer) SubmitIntent(streamer transactionpb.Transaction_Subm
164164 return handleSubmitIntentError (streamer , errors .New ("unhandled owner account type" ))
165165 }
166166 } else if err == common .ErrOwnerNotFound {
167- // Caught by later error
167+ if ! intentHasNewOwner {
168+ return handleSubmitIntentError (streamer , newIntentDeniedError ("unexpected owner account" ))
169+ }
170+ initiatorOwnerAccount = submitActionsOwnerAccount
168171 } else if err != nil {
169172 log .WithError (err ).Warn ("failure getting owner account metadata" )
170173 return handleSubmitIntentError (streamer , err )
171174 }
172175
173- // All intents must be initiated by a phone-verified user
174- if initiatorOwnerAccount == nil {
175- log .Info ("intent not initiated by phone-verified user 12 words" )
176- return handleSubmitIntentError (streamer , ErrNotPhoneVerified )
177- }
178176 log = log .WithField ("initiator_owner_account" , initiatorOwnerAccount .PublicKey ().ToBase58 ())
179177
180178 // Check that all provided signatures in proto messages are valid
0 commit comments