bitpay / wallet

Bitpay Wallet (formerly Copay) is a secure Bitcoin and other crypto currencies wallet platform for both desktop and mobile devices.
http://bitpay.com/wallet
MIT License
3.82k stars 1.74k forks source link

"The wallet is full" caused by communcation error #524

Closed jcoffland closed 10 years ago

jcoffland commented 10 years ago

I'm trying to repeat the demo I saw Ryan give in SF today. I built Copay following the instructions with out any problems. Then I ran the server and connected with Firefox. I created a new 2 of 2 wallet, then copied the secret to a new instance in Google Chrome and tried to join the wallet. I got an error "The wallet is full". The console shows the following:

    ### PrivateKey Initialized copayBundle.js:2042
## DESTROYING PEER INSTANCE copayBundle.js:2326
Adding peer/copayer 7Xcu4JLHVkUnhHQUSPn2XP8oGnVRXvQc72qkCQgSbhNNdX7T2b 035bb3595b12a277d939e98301ffd4ca6e3394a09b2cff6dac9fd70d6cddc1d5a1 copayBundle.js:2564
CREATING PEER INSTANCE: 7Xcu4JLHVkUnhHQUSPn2XP8oGnVRXvQc72qkCQgSbhNNdX7T2b copayBundle.js:2609
### STARTING CONNECTION TO:
    6zSuJST7fipY5Y18LsvXA71zehbztGyWsTrvXcMeUiaNVESPBa
    0314eb830305a54959d8f7cca6e0bb7cb3f54f90bec71471f0ed891743cfaab416 copayBundle.js:2689
PeerJS:  Creating RTCPeerConnection. peer.js:1117
PeerJS:  Listening for ICE candidates. peer.js:1117
PeerJS:  Listening for `negotiationneeded` peer.js:1117
PeerJS:  Listening for data channel peer.js:1117
PeerJS:  Listening for remote stream peer.js:1117
PeerJS:  `negotiationneeded` triggered peer.js:1117
PeerJS:  Created offer. peer.js:1117
PeerJS:  Set localDescription: offer for: 6zSuJST7fipY5Y18LsvXA71zehbztGyWsTrvXcMeUiaNVESPBa peer.js:1117
9
PeerJS:  Received ICE candidates for: 6zSuJST7fipY5Y18LsvXA71zehbztGyWsTrvXcMeUiaNVESPBa peer.js:1117
PeerJS:  Socket open peer.js:1117
18
PeerJS:  Received ICE candidates for: 6zSuJST7fipY5Y18LsvXA71zehbztGyWsTrvXcMeUiaNVESPBa peer.js:1117
PeerJS:  Setting remote description 
RTCSessionDescription {sdp: "v=0
↵o=Mozilla-SIPUA-28.0 21775 0 IN IP4 0.0.0.0
↵…ate:48 2 UDP 2122187006 10.1.3.1 42113 typ host
↵", type: "answer"}
sdp: "v=0
↵o=Mozilla-SIPUA-28.0 21775 0 IN IP4 0.0.0.0
↵s=SIP Call
↵t=0 0
↵a=ice-ufrag:e897cdc5
↵a=ice-pwd:6f4ecf70bbd335d345bcfeecc0002f2a
↵a=fingerprint:sha-256 06:19:A8:3A:D1:AB:79:FF:38:28:AA:30:75:4D:F6:6B:48:85:77:CD:F7:4B:FB:71:60:99:6B:52:1B:69:4C:52
↵m=audio 38265 RTP/SAVPF 111 126
↵c=IN IP4 192.168.10.15
↵a=rtpmap:111 opus/48000/2
↵a=ptime:20
↵a=rtpmap:126 telephone-event/8000
↵a=fmtp:126 0-15
↵a=inactive
↵a=setup:active
↵a=candidate:0 1 UDP 2122252543 192.168.10.15 38265 typ host
↵a=candidate:24 1 UDP 2122121471 172.16.0.10 45471 typ host
↵a=candidate:48 1 UDP 2122187007 10.1.3.1 60767 typ host
↵a=candidate:0 2 UDP 2122252542 192.168.10.15 51295 typ host
↵a=candidate:24 2 UDP 2122121470 172.16.0.10 44559 typ host
↵a=candidate:48 2 UDP 2122187006 10.1.3.1 49452 typ host
↵a=rtcp-mux
↵m=application 48856 DTLS/SCTP 5000 
↵c=IN IP4 192.168.10.15
↵a=sctpmap:5000 webrtc-datachannel 1024
↵a=setup:active
↵a=candidate:0 1 UDP 2122252543 192.168.10.15 48856 typ host
↵a=candidate:24 1 UDP 2122121471 172.16.0.10 42287 typ host
↵a=candidate:48 1 UDP 2122187007 10.1.3.1 46793 typ host
↵a=candidate:0 2 UDP 2122252542 192.168.10.15 45292 typ host
↵a=candidate:24 2 UDP 2122121470 172.16.0.10 55922 typ host
↵a=candidate:48 2 UDP 2122187006 10.1.3.1 42113 typ host
↵"
type: "answer"
__proto__: RTCSessionDescription
 peer.js:1117
PeerJS:  Set remoteDescription: ANSWER for: 6zSuJST7fipY5Y18LsvXA71zehbztGyWsTrvXcMeUiaNVESPBa peer.js:1117
PeerJS:  Data channel connection success peer.js:1117
### DATA CONNECTION READY: 6zSuJST7fipY5Y18LsvXA71zehbztGyWsTrvXcMeUiaNVESPBa (inbound: false) AUTHENTICATING... copayBundle.js:2495
### SENDING HELLO TO  0314eb830305a54959d8f7cca6e0bb7cb3f54f90bec71471f0ed891743cfaab416 copayBundle.js:2413
Adding peer/copayer 6zSuJST7fipY5Y18LsvXA71zehbztGyWsTrvXcMeUiaNVESPBa 0314eb830305a54959d8f7cca6e0bb7cb3f54f90bec71471f0ed891743cfaab416 copayBundle.js:2564
### ERROR IN DATA: "undefined"  false SyntaxError {stack: (...), message: "Unexpected token "} copayBundle.js:2434
### Deleting connection from peer: 6zSuJST7fipY5Y18LsvXA71zehbztGyWsTrvXcMeUiaNVESPBa copayBundle.js:2380
PeerJS:  Cleaning up PeerConnection to 6zSuJST7fipY5Y18LsvXA71zehbztGyWsTrvXcMeUiaNVESPBa peer.js:1117
### CLOSE RECV FROM: 6zSuJST7fipY5Y18LsvXA71zehbztGyWsTrvXcMeUiaNVESPBa copayBundle.js:2521
### Deleting connection from peer: 6zSuJST7fipY5Y18LsvXA71zehbztGyWsTrvXcMeUiaNVESPBa copayBundle.js:2380
PeerJS:  DataChannel closed for: 6zSuJST7fipY5Y18LsvXA71zehbztGyWsTrvXcMeUiaNVESPBa peer.js:1117
jcoffland commented 10 years ago

I found this on the Firefox side:

PeerJS: Creating RTCPeerConnection.
peer.js (line 1117)
PeerJS: Listening for ICE candidates.
peer.js (line 1117)
PeerJS: Listening for `negotiationneeded`
peer.js (line 1117)
PeerJS: Listening for data channel
peer.js (line 1117)
PeerJS: Listening for remote stream
peer.js (line 1117)
PeerJS: Setting remote description mozRTCSessionDescription { type="offer", sdp="v=0\r\no=- 86139404090370...brtc-datachannel 1024\r\n", toJSON=toJSON()}
peer.js (line 1117)
### NEW INBOUND CONNECTION 2/2
copayBundle.js (line 2546)
### PEER REJECTED. PEER MAX LIMIT REACHED
copayBundle.js (line 2548)
PeerJS: Added ICE candidate for: 7siq7gsWZFWe6185dLjoQXpc73CBfoGfq4JzofceZQ9PMworj5
27
peer.js (line 1117)
PeerJS: Set remoteDescription: OFFER for: 7siq7gsWZFWe6185dLjoQXpc73CBfoGfq4JzofceZQ9PMworj5
peer.js (line 1117)
PeerJS: Created answer.
peer.js (line 1117)
PeerJS: Set localDescription: answer for: 7siq7gsWZFWe6185dLjoQXpc73CBfoGfq4JzofceZQ9PMworj5
peer.js (line 1117)
PeerJS: Received data channel
peer.js (line 1117)
PeerJS: Data channel connection success
peer.js (line 1117)

###  CLOSING CONN FROM:7siq7gsWZFWe6185dLjoQXpc73CBfoGfq4JzofceZQ9PMworj5

copayBundle.js (line 2550)
PeerJS: Cleaning up PeerConnection to 7siq7gsWZFWe6185dLjoQXpc73CBfoGfq4JzofceZQ9PMworj5
peer.js (line 1117)

The error "PEER REJECTED. PEER MAX LIMIT REACHED" looks suspicious. Note that I don't have any other clients open but I did try to open two Copay clients in Firefox but then closed one because it couldn't connect.

jcoffland commented 10 years ago

Now, I'm getting the same thing if I try to connect from a second instance in Firefox.

matiu commented 10 years ago

localStorage is shared between the browser's instances. you need to connect a 2-2 wallet from 1 chrome and 1 firefox, or 1 chrome and 1 chrome in private mode.

jcoffland commented 10 years ago

It seems though that running two instances with the same localStorage corrupts the wallet beyond repair.

maraoz commented 10 years ago

@jcoffland can we close this?

jcoffland commented 10 years ago

@maraoz I think the corrupted wallet issue should be fixed. Note that the wallet is irrecoverably corrupted if you do what I did. This is something that other users will be likely to run into. It would be even better if the software gave a warning or error when you do this.

eordano commented 10 years ago

Outdated by peerjs deletion