This repository has been archived by the owner on Jun 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed aggregate transaction codex issue * fixed lint * Updated change log * Updated change log * - Added fromHeight & toHeight to receipt endpoint (#557) * Cosigner notification fix (#554) * Fixed transactions * Added multisig check on ws channel subscription * Fixed lint * Updated bootstrap * reset symbol-bootstrap version for travis build * - Added fromHeight & toHeight to receipt endpoint (#557) * Fixed transactions * Added multisig check on ws channel subscription * Fixed lint * Updated bootstrap * reset symbol-bootstrap version for travis build * Use async in buildAccountConditions * PR review fixes * - Restored the changes on subscription manager * Fixed bug in catapultDB, add self to the multisig list * Only check multisig account for partial transactions * Account pagination after filter (#560) * Fixed #558 * Update package.json Co-authored-by: fboucquez <fboucquez@gmail.com> * Updated symbol-bootstrap version * Removed pageIndex in account search second query * Restore previous comments * v2.3.2 change log (#565) * v2.3.2 change log * Fixed travis and travis tests Co-authored-by: fernando <fboucquez@gmail.com> Co-authored-by: Steven Liu <xian.f.liu@gmail.com>
- Loading branch information
Showing
13 changed files
with
184 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Copyright (c) 2016-2019, Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp. | ||
* Copyright (c) 2020-present, Jaguar0625, gimre, BloodyRookie. | ||
* All rights reserved. | ||
* | ||
* This file is part of Catapult. | ||
* | ||
* Catapult is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Catapult is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Catapult. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
const multisigUtils = { | ||
getMultisigGraph: (db, address) => { | ||
const getMultisigEntries = (multisigEntries, fieldName) => { | ||
const addresses = new Set(); | ||
multisigEntries.forEach(multisigEntry => multisigEntry.multisig[fieldName].forEach(multisigAddress => { | ||
addresses.add(multisigAddress.buffer); | ||
})); | ||
|
||
return db.multisigsByAddresses(Array.from(addresses)); | ||
}; | ||
|
||
const multisigLevels = []; | ||
return db.multisigsByAddresses([address]) | ||
.then(multisigEntries => { | ||
if (0 === multisigEntries.length) | ||
return Promise.resolve(undefined); | ||
|
||
multisigLevels.push({ | ||
level: 0, | ||
multisigEntries: [multisigEntries[0]] | ||
}); | ||
|
||
return Promise.resolve(multisigEntries[0]); | ||
}) | ||
.then(multisigEntry => { | ||
if (undefined === multisigEntry) | ||
return Promise.resolve(undefined); | ||
|
||
const handleUpstream = (level, multisigEntries) => getMultisigEntries(multisigEntries, 'multisigAddresses') | ||
.then(entries => { | ||
if (0 === entries.length) | ||
return Promise.resolve(); | ||
|
||
multisigLevels.unshift({ level, multisigEntries: entries }); | ||
return handleUpstream(level - 1, entries); | ||
}); | ||
|
||
const handleDownstream = (level, multisigEntries) => getMultisigEntries(multisigEntries, 'cosignatoryAddresses') | ||
.then(entries => { | ||
if (0 === entries.length) | ||
return Promise.resolve(); | ||
|
||
multisigLevels.push({ level, multisigEntries: entries }); | ||
return handleDownstream(level + 1, entries); | ||
}); | ||
|
||
const upstreamPromise = handleUpstream(-1, [multisigEntry]); | ||
const downstreamPromise = handleDownstream(1, [multisigEntry]); | ||
return Promise.all([upstreamPromise, downstreamPromise]) | ||
.then(() => multisigLevels); | ||
}); | ||
} | ||
|
||
}; | ||
|
||
module.exports = multisigUtils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.