Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit fcf6b9a

Browse files
authored
Merge pull request #1129 from lightninglabs/trim-seed-words
Trim seed word whitespace to avoid obscure errors.
2 parents 89b7448 + 14226ab commit fcf6b9a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/action/wallet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class WalletAction {
5353
* @param {number} options.index The seed index
5454
*/
5555
setRestoreSeed({ word, index }) {
56-
this._store.seedMnemonic[index] = word;
56+
this._store.seedMnemonic[index] = word.trim();
5757
}
5858

5959
/**

test/unit/action/wallet.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,11 @@ describe('Action Wallet Unit Tests', () => {
382382
wallet.setRestoreSeed({ word: 'foo', index: 1 });
383383
expect(store.seedMnemonic[1], 'to equal', 'foo');
384384
});
385+
386+
it('should trim whitespace', () => {
387+
wallet.setRestoreSeed({ word: ' foo ', index: 1 });
388+
expect(store.seedMnemonic[1], 'to equal', 'foo');
389+
});
385390
});
386391

387392
describe('setFocusedRestoreInd()', () => {

0 commit comments

Comments
 (0)