ergo icon indicating copy to clipboard operation
ergo copied to clipboard

Implicit unlock after wallet initialization fails

Open pragmaxim opened this issue 3 years ago • 0 comments

When wallet is newly created then we call automatically Unlock with given wallet password https://github.com/ergoplatform/ergo/blob/978a170d45c08f8e0aaf051b93c965c40f47259d/src/main/scala/org/ergoplatform/nodeView/wallet/ErgoWalletActor.scala#L101

But now it throws :

10:40:53.351 INFO  [ergoref-api-dispatcher-10] o.e.n.w.ErgoWalletActor - Wallet is initialized                
10:40:53.352 INFO  [ergoref-api-dispatcher-10] o.e.n.w.ErgoWalletActor - Unlocking wallet                                            
10:40:53.363 WARN  [ergoref-api-dispatcher-10] o.e.n.w.ErgoWalletActor - Wallet unlock failed with:                                                
java.lang.RuntimeException: SecretString already erased                                                                                            
        at org.ergoplatform.wallet.interface4j.SecretString.checkErased(SecretString.java:29)                  
        at org.ergoplatform.wallet.interface4j.SecretString.getData(SecretString.java:55)                                                                                                                                                                                                             
        at org.ergoplatform.wallet.secrets.JsonSecretStorage.$anonfun$unlock$6(JsonSecretStorage.scala:68)                                                                                                                                                                                            
        at scala.util.Success.flatMap(Try.scala:251)                                                                                               
        at org.ergoplatform.wallet.secrets.JsonSecretStorage.$anonfun$unlock$1(JsonSecretStorage.scala:67)                                                                                                                                                                                            
        at scala.util.Either$RightProjection.map(Either.scala:713)                                                                                 
        at org.ergoplatform.wallet.secrets.JsonSecretStorage.unlock(JsonSecretStorage.scala:58)                                                    
        at org.ergoplatform.nodeView.wallet.ErgoWalletServiceImpl.unlockWallet(ErgoWalletService.scala:344)                                        
        at org.ergoplatform.nodeView.wallet.ErgoWalletActor$$anonfun$org$ergoplatform$nodeView$wallet$ErgoWalletActor$$loadedWallet$1.applyOrElse(ErgoWalletActor.scala:322)                                                                                                                          
        at akka.actor.Actor.aroundReceive(Actor.scala:537)                                                                                                                                                                                                                                            
        at akka.actor.Actor.aroundReceive$(Actor.scala:535)              
        at org.ergoplatform.nodeView.wallet.ErgoWalletActor.aroundReceive(ErgoWalletActor.scala:33)                                                                                                                                                                                                   
        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:577)                                                                                                                                                                                                                                   
        at akka.actor.ActorCell.invoke(ActorCell.scala:547)                                                                                                                                                                                                                                           
        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270)                                                                                                                                                                                                                                    
        at akka.dispatch.Mailbox.run(Mailbox.scala:231)                                                                                                                                                                                                                                               
        at akka.dispatch.Mailbox.exec(Mailbox.scala:243)                                                                                                                                                                                                                                              
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)                                                                                                                                                                                                                  
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)                                                                                                                                                                                                 
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)                                                                
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)                                                           
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)                                                  
[INFO] [akkaDeadLetter][11/01/2022 10:40:53.367] [ergoref-akka.actor.default-dispatcher-5] [akka://ergoref/user/$g] Message [scala.util.Failure] from Actor[akka://ergoref/user/$g#-945183121] to Actor[akka://ergoref/user/$g#-945183121] was unhandled. [1] dead letters encountered. This logging c
an be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.                      

However following explicit Unlock from user interface works fine, so we did not notice however the the Regression is there and wallet should be Unlocked implicitly when created ... This is because we call pass.erase on the existing instance in the init method.... And it cannot be reused in the consequent Unlock

pragmaxim avatar Nov 01 '22 09:11 pragmaxim