Allow author extract from empty (#1761)

This commit is contained in:
Jaco Greeff
2020-01-28 19:16:08 +01:00
committed by GitHub
parent 1686f8b357
commit 18c302d2cf
@@ -79,10 +79,12 @@ export default class ConsensusEngineId extends U32 {
* @description From the input bytes, decode into an author
*/
public extractAuthor (bytes: Bytes, sessionValidators: AccountId[]): AccountId | undefined {
if (this.isAura) {
return this.getAuraAuthor(bytes, sessionValidators);
} else if (this.isBabe) {
return this.getBabeAuthor(bytes, sessionValidators);
if (sessionValidators?.length) {
if (this.isAura) {
return this.getAuraAuthor(bytes, sessionValidators);
} else if (this.isBabe) {
return this.getBabeAuthor(bytes, sessionValidators);
}
}
return undefined;